Microsoft 'C' - Problem with Spawns & Open files
Bellcore CIM
cim at pyuxv.UUCP
Mon May 12 10:49:24 AEST 1986
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.
More information about the Comp.lang.c
mailing list