Thread View: borland.public.cppbuilder.nativeapi
7 messages
7 total messages
Started by Babak
Thu, 08 Jun 2006 05:30
Crazy CopyFile
Author: Babak
Date: Thu, 08 Jun 2006 05:30
Date: Thu, 08 Jun 2006 05:30
13 lines
1322 bytes
1322 bytes
I had wrote some CopyFile functions in my software
I code them in Win98 BCB5 and it work ok in Win98 BUT it works only in some
of WinXP !!
I got so surprised ! In some WinXP CopyFile wont copy any file but that
workd OK in some other WinXP.
Any Suggestions?
1- The Like is something like this :
CopyFile("profiles.DB","c:\\Portable\\profiles.DB",true);
2-The File is Existing in Both Tries Win98 and WinXP
3-I dont think if WinXP cares about the Capital Case or Lower case !! :-\
Please guide, thanks
Re: Crazy CopyFile
Author: Hans Galema
Date: Thu, 08 Jun 2006 07:16
Date: Thu, 08 Jun 2006 07:16
17 lines
1416 bytes
1416 bytes
Babak wrote:
> I had wrote some CopyFile functions in my software
<help>
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
To get extended error information, call GetLastError.
</help>
> CopyFile("profiles.DB","c:\\Portable\\profiles.DB",true);
What is the returnvalue if CopyFilefails ? And what does GetLastError
report ?
I would suggest an absolute path in the first parameter too.
Hans.
Re: Crazy CopyFile
Author: Andrue Cope [TeamB]
Date: Thu, 08 Jun 2006 08:45
Date: Thu, 08 Jun 2006 08:45
18 lines
1409 bytes
1409 bytes
Hans Galema wrote: > I would suggest an absolute path in the first parameter too. Absolutely :) One of our golden rules. Relative paths should only exist outside of the executing image and even then they should be relative to some fixed 'anchor' file. We also insist on directory paths having a trailing terminator at all times. It not only helps avoid having to check first before appending the file name but on several occasions has helped us during debugging. -- Andrue Cope [TeamB] [Bicester, Uk] http://info.borland.com/newsgroups/guide.html
Re: Crazy CopyFile
Author: Hans Galema
Date: Thu, 08 Jun 2006 09:12
Date: Thu, 08 Jun 2006 09:12
10 lines
1449 bytes
1449 bytes
Andrue Cope [TeamB] wrote: > We also insist on directory paths having a trailing terminator at all > times. It not only helps avoid having to check first before appending > the file name but on several occasions has helped us during debugging. That is just a choice I suppose. You could as well have decided always without. Or is there more behind it ? Hans.
Re: Crazy CopyFile
Author: Andrue Cope [TeamB]
Date: Thu, 08 Jun 2006 10:36
Date: Thu, 08 Jun 2006 10:36
47 lines
2616 bytes
2616 bytes
Hans Galema wrote: > That is just a choice I suppose. > You could as well have decided always without. Or is there more > behind it ? It's part of our coding standards. Shortage of resources (ie;two people) and size of code base (~20MB) plus the nature of our work environment (task driven and frequently interrupted) mean that coding and data standards are important. If a bug stops an engineer getting their work done we have to be able to switch track and fix it as quickly as possible. We don't have the time to relearn minutae of source code nor to document every last detail. Another reason is that we have had to implement path parsing functions and by coming up with a definitive set of rules it's easier. We tend to favour pedantic algorithms in our code. That way (in theory) the state of an executing process is more easily predicted. FWIW: 4.2.1. Definition:Object name A sequence of any characters except �\� and �:�. 4.2.2. Definition:Volume ID An object name and trailing ':'. 4.2.3. Definition:Directory path A series of object names all of them having a trailing '\'. 4.2.4. Definition:File name An object name appearing at the end of a directory path. 4.2.5. Definition:File name extension (informational only) An object name that follows the rightmost �.� in a file name. 4.2.6. Definition:Stream name An object name following a file name and separated by ':'. A fully qualified file path is therefore: [<Volume ID>]\<directory path><filename>[:<stream name>] -- Andrue Cope [TeamB] [Bicester, Uk] http://info.borland.com/newsgroups/guide.html
Re: Crazy CopyFile
Author: Hans Galema
Date: Fri, 09 Jun 2006 07:11
Date: Fri, 09 Jun 2006 07:11
38 lines
2019 bytes
2019 bytes
Andrue Cope [TeamB] wrote: > 4.2.1. Definition:Object name > A sequence of any characters except �\� and �:�. So '/' is allowed. > 4.2.2. Definition:Volume ID > An object name and trailing ':'. > > 4.2.3. Definition:Directory path > A series of object names all of them having a trailing '\'. C:\ape\ is not a directory path ? > 4.2.4. Definition:File name > An object name appearing at the end of a directory path. > > 4.2.5. Definition:File name extension (informational only) > An object name that follows the rightmost �.� in a file name. > > 4.2.6. Definition:Stream name > An object name following a file name and separated by ':'. > > A fully qualified file path is therefore: Sorry, but you should first /define/ what a fully qualified path is, before you show how it looks, I think. > [<Volume ID>]\<directory path><filename>[:<stream name>] And is this covered: \\computername\c\apes\ Just some thoughts FWIW. Hans.
Re: Crazy CopyFile
Author: Andrue Cope [TeamB]
Date: Fri, 09 Jun 2006 07:55
Date: Fri, 09 Jun 2006 07:55
43 lines
2733 bytes
2733 bytes
Hans Galema wrote: > > 4.2.1. Definition:Object name > > A sequence of any characters except �\� and �:�. > > So '/' is allowed. No that's considered to be a post-processing feature. Again it's about standardising. Paths while we are working on/with them have '\'. If they need to have '/' the conversion is performed as late as possible and is considered to be a 'fix up' operation. > C:\ape\ > is not a directory path ? Heh, generally we would say that it is but officially it's a volume ID and directory path. At the moment the distinction doesn't really matter but if we ever move development to Linux it might become more important. > Sorry, but you should first define what a fully qualified path is, > before you show how it looks, I think. You could be right. Changes to our database recently and even corporate structure mean that we are going to have to revisit our path handling anyway. We have extensions that allow us to specify virtual files (files within databases so a path containing two paths <g>) and a subset for specificying devices (like the Windows \\.\ syntax) and they haven't changed in over a decade. > And is this covered: > \\computername\c\apes\ > > Just some thoughts FWIW. It's not, no. All our I/O is performed using the wide path form so the '\\' would be stripped off prior to processing then added later. That would produce a relative path so some functionality might get confused. Normal I/O seems fine having tested it but I think some of our database handling might a bit upset not having a volume ID. -- Andrue Cope [TeamB] [Bicester, Uk] http://info.borland.com/newsgroups/guide.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads