in reply to Replace filename with pipe in program argument?

How much do you know about the C program(s) that you'll be running this way? Sometimes, when command-line tools are written to require filename args, a filename of "-" (dash character \0x2d) is accepted as referring to stdin (when the required arg is an input file name) or stdout (when the required arg is an output file name).

If your C programs follow this sort of convention, do a pipeline "open()" to launch the sub-process, and put "-" where the output file name should be. Then read from the pipeline file handle in the normal way, just like reading from any data file.

(If the C programs don't follow this convention, and you don't have / can't update the C source code, and you can't create a named pipe as suggested in an earlier reply, then you'll just have to put up with saving output to a named file, and reading that file as a separate step in your perl script.)

  • Comment on Re: Replace filename with pipe in program argument?