[ee122] Is stdin a stream?

Richard Schmidt huntingtonsurfca at gmail.com
Mon Sep 17 18:09:17 PDT 2007


To answer my own question, yes. stdin can be used as a valid stream and
seems to ahave all the same properties.

I tested using an offline version of my code echoing back what was written.

---------- Forwarded message ----------
From: Richard Schmidt <huntingtonsurfca at gmail.com>
Date: Sep 17, 2007 4:55 PM
Subject: Is stdin a stream?
To: ee122 at icsi.berkeley.edu


I'm putting the input into a buffer using fgets (which will automatically
tie everything up for me nicely), but if EOF is returned first or an error
is returned, the retrn value is a null pointer.

feof() takes a stream in and looks for an EOF flag, but I don't know if we
can treat stdin as an argument to that function.

also, what should the client do if a user types in a partial message and
then hits the EOF key? should we assume the user wants to break the
operation/connection or should we send out the data before the EOF key?

finally, if an error does occur, should handling things gracefully mean
trying to re-establish a connection, asking the user if they want to try and
re-establish, returning 1 (error) or just returning 0 (success)?

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/ee122/attachments/20070917/17065864/attachment-0001.html 


More information about the ee122 mailing list