Re: system() and copy in DOS
- Posted by Travis Beaty <tbeaty at osage.net> Jul 30, 2003
- 437 views
Hello! Okay, thanks everyone. Juergen, I'll look into the library. I wanted to try to have all the include files be cross-platform, but it's now looking more like I'm going to have to make a separate include file which contains all the platform-specific code. I guess that's okay, just not how I originally planned. Thanks everyone! Travis Beaty Osage, Iowa. Juergen Luethje wrote: > > > Me wrote: > > >>Rob wrote: >> >> >>>Travis Beaty wrote: >>> >>>>In Linux, this works fine. However, in Windows XP I'm having a bit of a >>>>problem because the filename being copied is truncated to eight >>>>characters. Apparently it is a problem with long filenames, which as I >>>>recall Euphoria has had some issues with in the past. I don't think >>>>that it is Euphoria though, because of the fact that Euphoria isn't >>>>actually doing the copying, it is simply calling the DOS copy command >>>>via a call to system(). >>> >>>When you run the system() command in ex.exe, >>>XP runs an old version of DOS that >>>only supports 8.3 filenames. >> >> >>In that situation, *long* filenames can be processed by using my library >>"Lfn.zip" from the user contributions page. >>Instead of >> system("del " & bkname, 2) >> system("copy " & name & " " & bkname, 2) >> >>one has then to write >> system("del " & short_name(bkname), 2) >> system("copy " & short_name(name) & " " & short_name(bkname), 2) > > ^^^^^^^^^^^^^^^^^^ > Oops. If forgot to mention, that this may not lead to the desired > result. 'short_name(file)' only works as expected, if 'file' already > exists. To achieve this, don't delete it before copying. If the > destination file does *not* already exist, just let your program first > create a small destination file with the desired long 'bkname'. > > BTW: I personally prefer to let my program copy the data itself, using a > small while() loop. I don't know, which method is faster. > > >>>If you run system() using exw.exe >>>(or exwc.exe - see euphoria\bin\makecon.exw) >>>you'll get full support for long filenames. > > > Best regards, > Juergen >