Path: utzoo!attcan!uunet!mcvax!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.sys.atari.st Subject: Re: Copying a file over itself Message-ID: <565@philmds.UUCP> Date: 19 Jul 88 14:55:08 GMT References: <4507@pasteur.Berkeley.Edu> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 39 In article <4507@pasteur.Berkeley.Edu> landay@cory.Berkeley.EDU (James A. Landay) writes: >Last night (at 3AM) I accidently copied a file over itself. >This seems to trash the file rather than touching the date >or doing nothing. Will this be fixed in the new ROM version? (Atari?) Tried it with a 14K file (i.e. copying from the Desktop), but the contents remained the same. The date was changed. Then I tried it with a simple copy program, like this: #include #include #include main() { int fdi, fdo, nread; char buf[BUFSIZ]; fdi = Fopen("test.dat",O_RDONLY); fdo = Fopen("test.dat",O_WRONLY|O_CREAT|O_TRUNC); while ((nread = Fread(fdi,BUFSIZ,buf)) > 0) { Fwrite(fdo,nread,buf); } Fclose(fdi); Fclose(fdo); } Odd enough, even though O_TRUNC was specified the contents remained the same (in Unix you would get an empty file). Also the date was not changed. Interchanging the Fopen calls didn't make any difference. So the next question is perhaps: what ROM version are you using now? Leo. B.T.W. What in the world made the GEMDOS writers decide to swap the second and third parameter in the Fread and Fwrite calls, compared with Unix read() and write() ? Since they 'leant' quite a few things from Unix, wouldn't it have been easier to use the same parameter ordering?