popen()

Julian ANIGBOGU anigbogu at loria.crin.fr
Tue Mar 6 03:15:41 AEST 1990


Hello Guys. Given the enormous number of responses I got to my
question on the above subject, I guess it would be in order to give a
summary of the solutions proposed. At the same time I'll like to thank
the following chaps who jumped onto the rescue-waggon. I responded
individually to some but they might have bounced: 

Len Reed, Raymond Chen, Richard Brittain, Chris Larsen, Mr.
HappyWOWface, PeterG, Kaled Keithley, Doug McDonald, Steve Yelvington
etc. Please, don't feel slighted if your name didn't show up!!

Granted that DOS is not multi-tasking OS, one can still fake pipes by
first spawning the program (In my case 'uncompress') that is being
piped , turn the IO parameter from "r" to "w", writing the output to a
TMP file, (which in effect equivalent to writing to STDOUT (if not
already in use) and redirecting into a file which is a longer process
[IMHO]), reopening the file in "r" mode and passing the handle back
the program that spawn 'uncompress'. This seems neat enough for what
I'm doing as the main program is completely unaware of the "dirty
tricks" being played.

I first found my salvation in Ian Stewartson's implementation of the
Unix (sh) ie. after I sent out my question. From some of the responses
I got I'm apparently not the only one confronted with such problems.
What I failed to add in my origal posting was the absence of time
constraint. My goal was having as many compressed rasterfiles as I
could pack onto the hard-disk and uncompressing them as I need them
without the need to explicitely do that in a batch file and calling
the main program recursively. I guessed that if I could get away with
'popen' on Unix it wouldn't cause any harm faking that on DOS.

Julian


-- 
				---------------------------------------
e-mail:	anigbogu at loria.crin.fr 	| All opinions expressed here are      |
				|  naturally mine. However ...         |
				----------------------------------------



More information about the Comp.lang.c mailing list