nigel@cmsfl@labtam.oz (Nigel Harwood) (07/09/90)
Thanks to all you good folks who dumped on me regarding popen(), I deserved it, although if I read another RTFM message I think I'll core dump for sure .... ;-) One of the reasons I got of track and missed pclose() was that I was trying a bit of a short cut for variable expansion where waiting for the pclose() wasn't immediately obvious. Basically, to save the hassle of scanning a given small data file for variables (which it could legally contain for this application) I thought I would get /bin/sh to do it for me. Basically each line was encapsulated with echo "datafromfile" >> tmpfile (I escaped any double quotes in the input.) This was all then piped through /bin/sh. This works fine and I don't need to do variable expansion in the program making it smaller, plus I get the other benefits of the other shell facilities `` etc which I would never have included. Only thing is it seems pretty fudgey to my conscience so I throw it open for a better more elegant way to do the same thing. The only thing is that I don't want to add 1000 lines of expansion code to the program to do it. Well, if you are interested in the challenge then I guess I'll here from you ... Regards -- <<<<<<<<<<<<<<<<<<<<<<<<< Nigel Harwood >>>>>>>>>>>>>>>>>>>>>>>>>>> << Post: Coles Myer Ltd, PO Box 2000 Tooronga 3146, Australia >> << Phone: +61 3 829 6090 E-mail: nigel@cnw01.storesys.coles.oz.au >> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -- <<<<<<<<<<<<<<<<<<<<<<<<< Nigel Harwood >>>>>>>>>>>>>>>>>>>>>>>>>>> << Post: Coles Myer Ltd, PO Box 2000 Tooronga 3146, Australia >> << Phone: +61 3 829 6090 E-mail: nigel@cnw01.storesys.coles.oz.au >> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>