Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!husc6!panda!genrad!decvax!bellcore!ulysses!gamma!pyuxww!pyuxv!cim From: cim@pyuxv.UUCP (Bellcore CIM) Newsgroups: net.lang.c,net.micro.pc Subject: Microsoft 'C' - Problem with Spawns & Open files Message-ID: <202@pyuxv.UUCP> Date: Sun, 11-May-86 20:49:24 EDT Article-I.D.: pyuxv.202 Posted: Sun May 11 20:49:24 1986 Date-Received: Wed, 14-May-86 07:03:20 EDT Organization: Bellcore Lines: 27 Xref: linus net.lang.c:8227 net.micro.pc:7795 I'm having a problem using the Microsoft C 3.0 'spawnlp' function with open files in the calling program. (PCDOS-3.1, IBM PC/XT) After returning from the spawn, all file pointers (except stdin,stdout etc) are randomised ! The spawned program does nothing except print 'hello world' & exit. I've tried: a) Using 'system' instead of 'spawn' - no change b) 'dup'ing the relevent file descriptors before the spawn, and trying to restore them afterwards - no change c) Using 'freopen' to reopen the file as the standard input, and then read 'stdin' - no change. The only work-around I've found so far is to do 'ftell's on the files before the function, then 'fseek's afterwards - which, to put it mildly, is a really putrid kludge. Does anyone have a better fix ? Robert Fair. ihnp4!pyuxv!cim2 Bell Communications Research. Piscataway NJ My signature line has given up in disgust & become a COBOL programmer.