From: Ara.T.Howard@... Date: 2004-08-24T06:00:42+09:00 Subject: Re: Stupid C... On Tue, 24 Aug 2004, Lennon Day-Reynolds wrote: > Okay, I'll answer my own question, just in case anyone's curious. This > started working as soon as I changed the following lines: > fclose(stdin); > dup2(this_fh, fileno(stdin)); > > to these: > close(0); > dup2(this_fh, 0); > > Go figure. Now I just have to make in work in Windows. > > Fun, fun. > > -- > Lennon > rcoder.net flclose (stdin) is defined to only close the FILE *stdin, it is an implementation detail that it happend to have an fd underneath. perhaps try generating a tmpfile and freopen (tmp, 'r', stdin); -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | A flower falls, even though we love it; | and a weed grows, even though we do not love it. | --Dogen ===============================================================================