Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!ednor!sgr From: sgr@ednor.UUCP (Steve Reppucci) Newsgroups: comp.sys.ibm.pc Subject: Question on DOS APPEND command Keywords: APPEND Message-ID: <762@ednor.UUCP> Date: 3 May 89 18:27:45 GMT Reply-To: sgr@ednor.UUCP (Steve Reppucci) Organization: Boston Business Computing, Ltd.; Lawrence, MA Lines: 81 Expires: References: Sender: Followup-To: Here's a question concerning the DOS APPEND command. I'm trying to open a file from a C program (using either open() or fopen()... they behave similarly). I'm running DOS 3.3, and compiling with MSC-51 (although I get the same results if I compile with TC-20). I have set a 'data search path' using the APPEND command. It seems that if the file I'm attempting to open doesn't exist, AND a file with the same name exists in a directory that's in the search path, then that file (in the search path) gets opened (and overwritten). Note that this happens even though I've specified the full DOS pathname in the open call. My question is, is this correct behavior ?? Seems unlikely to me that the APPEND search path should be accessed at all if the file is opened using a full pathspec. And is this a compiler problem, or a DOS problem ? Is there a workaround ?? Please reply via E-Mail, I'll post a summary if there's any interest. Thanks in advance for any responses. A simplified test case output follows: ======================================================= E:\TEST1> DIR Directory of E:\TEST1 . 5-03-89 12:58p .. 5-03-89 12:58p TEST C 375 5-03-89 1:07p TEST EXE 9502 5-03-89 1:08p FOO TMP 37 5-03-89 1:25p 5 File(s) 764416 bytes free E:\TEST1> type foo.tmp This is data from \test1\foo.tmp E:\TEST1> dir \test2 Directory of E:\TEST2 . 5-03-89 12:58p .. 5-03-89 12:58p 2 File(s) 763904 bytes free E:\TEST1> type test.c /* #include */ main() { /* Built with MSC 5.1 */ int f; static char s[] = "This data was written to \\test2\\foo.tmp"; if ((f = open( "\\TEST2\\FOO.TMP", O_BINARY | O_RDWR)) == (-1)) { puts("\nError opening file\07"); exit(0); } write( f, s, strlen(s)); close(f); exit(0); } E:\TEST1> append e:\test1 E:\TEST1> append APPEND=E:\TEST1 E:\TEST1> dir Directory of E:\TEST1 . 5-03-89 12:58p .. 5-03-89 12:58p TEST C 375 5-03-89 1:07p TEST EXE 9502 5-03-89 1:08p FOO TMP 39 5-03-89 1:25p 5 File(s) 763392 bytes free E:\TEST1> test E:\TEST1> type foo.tmp This data was written to \test2\foo.tmp E:\TEST1> dir Directory of E:\TEST2 . 5-03-89 12:58p .. 5-03-89 12:58p 2 File(s) 762880 bytes free -- Steve Reppucci Boston Business Computing, Ltd. uunet!ednor!sgr