using fprintf to write to a file...
Posted on 2004-12-01
Ive inherited some code which I have modified and it works fiine!
Essentially, it reads in a stream from stdin, does stuff and writes it out to a new user defined stream.
Ive used streams just because I thought it would give me most flexibility for future development.
I wrapped my C binary in a shell wrapper and redirected my stream output by using binary_name 6>file.out
For operational reasons I need to change that so that instead of sending my fprintf to my stream, I send it straight to the file.
That wouldnt seem to be an insummountable problem but I cant seem to do it!!
Can anyone help? I thought it should be easy for me to change fprintf(STREAM,string) to fprintf(FILE,string) because I thought an open file took a stream as its input anyway, so in essence I should just be able to somehow point my stream to the file?