?
=?iso-8859-1?q?Jos=E9_de_Paula?=
I'm writing a little BrainFuck interpreter (by the way, gbf.sourceforge.net)
that can read the BrainFuck program from stdin; when the interpreter gets an
EOF, it stops reading the BrainFuck program and starts interpreting it;
BrainFuck has i/o facilities, and I use stdin/stdout to receive/spit out the
BrainFuck fluff. The problem is that stdin seems to lock after fgetc() gets
an EOF from it, and doesn't reset anymore. If I get the BrainFuck program
text from a file, it all works correctly, but if I read the text from stdin,
get an EOF, and keep on trying to read from it, the interpreter hangs. How
can I reset the EOF status (if there is such a thing) of stdin? Or is there
a workaround for this problem?
If you want to test-drive it, please mail me.
that can read the BrainFuck program from stdin; when the interpreter gets an
EOF, it stops reading the BrainFuck program and starts interpreting it;
BrainFuck has i/o facilities, and I use stdin/stdout to receive/spit out the
BrainFuck fluff. The problem is that stdin seems to lock after fgetc() gets
an EOF from it, and doesn't reset anymore. If I get the BrainFuck program
text from a file, it all works correctly, but if I read the text from stdin,
get an EOF, and keep on trying to read from it, the interpreter hangs. How
can I reset the EOF status (if there is such a thing) of stdin? Or is there
a workaround for this problem?
If you want to test-drive it, please mail me.