Thread: Stream I/O

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    96

    Stream I/O

    I am having trouble finding good websites to reference on Stream I/O so I can do some research on it. Any good references?

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    This one looks good. It is very concise/precise.

    Read the stuff on "low level" i/o, too. I think people learning C actually get sold the idea that there is something better or easier about using "streams" (when really there is not) because otherwise they would not be motivated to understand them, which they do provide a conceptual contrast or development. But the low level functions are actually simpler and work better. The higher level ones (streaming) use the low level ones in the background anyway.
    Last edited by MK27; 02-21-2009 at 07:15 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    96
    Oh I definitely understand what your saying MK, I should have specified that I also am making a webpage specific to stream I/O and that is why I would like to gather as much information as I can on the subject. Thank you though

  4. #4
    Registered User
    Join Date
    Nov 2007
    Posts
    96
    Any suggestions?

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Hi! What I meant was that since stream I/O functions are built on top of low level functions, a great way to present them would be (for example) to use some source code for fopen(), etc. (you could distill this from which ever "real world" source you want) which uses the lower level functions, and thus demonstrate how stream I/O works, and what the commands do when you use them.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by MK27
    I think people learning C actually get sold the idea that there is something better or easier about using "streams" (when really there is not)
    I'd say that one advantage of streams over low level functions is that they are standard.

    Quote Originally Posted by MK27
    But the low level functions are actually simpler and work better.
    They are not necessarily simpler, e.g., many functions in the Windows API do not really follow the "do one thing and do it well" principle that is more common place in *nix interfaces.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by laserlight View Post
    I'd say that one advantage of streams over low level functions is that they are standard.

    They are not necessarily simpler, e.g., many functions in the Windows API do not really follow the "do one thing and do it well" principle that is more common place in *nix interfaces.
    So fopen() would be considered more portable than open(), and fscanf() more than read()?
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by MK27
    So fopen() would be considered more portable than open(), and fscanf() more than read()?
    Definitely, though I think that fread() is a closer equivalent to read().
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Raw I/O vs. Stream I/O
    By NuNn in forum C Programming
    Replies: 1
    Last Post: 03-17-2009, 08:32 AM
  2. I/O stream files
    By malooch in forum C Programming
    Replies: 4
    Last Post: 12-12-2006, 09:58 AM
  3. Overlapped I/O and Completion Port :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 10-30-2002, 05:14 PM
  4. i/o stream
    By lupi in forum C++ Programming
    Replies: 1
    Last Post: 09-09-2001, 12:55 AM
  5. Looping and I/O Stream
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 09-07-2001, 10:20 AM