Xref: utzoo comp.lang.c:26549 comp.sys.ibm.pc.programmer:236 Path: utzoo!attcan!telly!druid!darcy From: darcy@druid.uucp (D'Arcy J.M. Cain) Newsgroups: comp.lang.c,comp.sys.ibm.pc.programmer Subject: Re: popen() Summary: DOS is a single tasking system Keywords: pipe DOS Message-ID: <1990Mar4.142531.4231@druid.uucp> Date: 4 Mar 90 14:25:31 GMT References: <1503@loria.crin.fr> Reply-To: darcy@druid.UUCP (D'Arcy J.M. Cain) Followup-To: comp.sys.ibm.pc.programmer Organization: D'Arcy Cain Consulting, West Hill, Ontario Lines: 27 In article <1503@loria.crin.fr> anigbogu@loria.crin.fr (Julian Anigbogu) writes: >Can some kind soul point me to where I can get a PC implementation of >the Unix C popen() /* for handle to a pipe */. I manipulate huge >rasterfiles(from a scanner) on a Sun and I adopted the policy of >compressing all files to save disk space. I open them with >popen("uncompress -c filename","r") so that they remain compressed on >disk. > > I now need to port the programs to DOS and to my chagrin my regular >compiler doesn't implement a pipe open. > With good reason. DOS is a single tasking system so you can't have a program running without putting the current one on hold first. The best way to do what you want is to have the uncompression itself as a subroutine that returns a specified number of bytes and just call it instead of a read function. This is the way I did it and it works just fine. My function returns one byte at a time although you could easily make the number of bytes to return a parameter. This is not really a C question so followups directed to comp.sys.ibm.pc.programmer -- D'Arcy J.M. Cain (darcy@druid) | Thank goodness we don't get all D'Arcy Cain Consulting | the government we pay for. West Hill, Ontario, Canada | (416) 281-6094 |