1. RE: Duplicated files program
- Posted by rforno at tutopia.com Jul 23, 2002
- 382 views
Kat: This is not the problem. Each drive under DOS/Windows has at any time its current dir. If I issue: i = chdir("D:\\GAMES"), I am changing the current dir of D: (a thing I don't want to do) and, moreover, current_dir() still returns the current dir of C:, for example C:\ZZ. If, instead, I write: i = chdir("D:"), nothing happens. What I want to know is the current dir of a drive different from the one I am executing my program. This works with system() under ex, but not under exw. Please have a look to my NEWDUP.EXW program that I sent earlier. Regards. ----- Original Message ----- From: Kat <gertie at PELL.NET> To: EUforum <EUforum at topica.com> Sent: Tuesday, July 23, 2002 10:14 PM Subject: Re: Duplicated files program > > On 23 Jul 2002, at 21:55, rforno at tutopia.com wrote: > > > > > Rob: > > It seems I performed not enough testing on my program. > > While I was walking for an errand, it came to my mind a subtle potential > > error, and when I returned home, I hurried to correct it. Then I found > > several more bugs... :( > > Now I have fixed all of them, with two exceptions: > > 1) The problem of walk_dir with path "/" under Linux, that I already > > mentioned to you. I think you can fix it easily. > > 2) There is another problem under DOS and Windows. Using ex, system("D:", 2) > > changes to drive D: and then current_dir() gives the path (for example) D:\ or > > maybe D:\GAMES. But using exw, system("D:", 2) seems to do nothing, and after > > that current_dir() gives (for example) C:\EUPHORIA\TEST. I am using system("D:", > > 2) to know what is the current dir for drive D: if one specifies on the command > > line (for example) D:CHESS or simply D: As a result, one has to specify an > > absolute path for drives that are not the current one. Please tell me if there > > is a solution to this problem. > > Syntax: include file.e > i = chdir(s) Description: Set the current directory to the path given by sequence > s. s must name an existing directory on the system. If successful, chdir() returns 1. > If unsuccessful, chdir() returns 0. > > This works for me. > > Kat > > > >
2. RE: Duplicated files program
- Posted by rforno at tutopia.com Jul 26, 2002
- 380 views
If there are more than one DOS window, each one has its current dir, independently of the others. So, under DOS, there is no problem. I admit I don't know what Windows does when issuing system("D:", 2) (apparently nothing), but in any case, in a DOS windows, it applies only to the issuing window, not others nor to DOS as a whole. However, assume you have a test.bat file in drive C:, reading: D: cd \ dir > xx and the current directory of D: is D:\GAMES Then, if you execute system("test", 2), D:\xx will contain the root directory of D:, but afterwards the current directory will be the original from C:, and the current directory of D: will be the same as before. ----- Original Message ----- From: Juergen Luethje <jluethje at gmx.de> To: EUforum <EUforum at topica.com> Sent: Wednesday, July 24, 2002 9:59 AM Subject: Re: Duplicated files program > > Ricardo <rforno at tutopia.com> wrote: > > <snip> > > Each drive under DOS/Windows has at any time its current dir. > > This applies to DOS. Are you sure, that it applies to Windows, too? > After reading > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/dirr ef_6g6x.asp > I _assume_, on Windows there is only one current directory. > > > If I issue: > > i = chdir("D:\\GAMES"), I am changing the current dir of D: (a thing I don't > > want to do) and, moreover, current_dir() still returns the current dir of > > C:, for example C:\ZZ. > > If, instead, I write: > > i = chdir("D:"), nothing happens. > > What I want to know is the current dir of a drive different from the one I > > am executing my program. This works with system() under ex, but not under > > exw. > > system() starts a new DOS shell. For example, using system("D:", 2) sets > the current drive to D: _on DOS_. > When you call system("D:", 2) from a Windows program, I _assume_ that > Windows simply doesn't know what has happened on DOS. > > > Please have a look to my NEWDUP.EXW program that I sent earlier. > > Regards. > <snip> > > Another consideration concerning current_dir(): > What happens, when another program changes the current directory, while > your program is running? > > Regards, > Juergen > > > >