Thread: Stream reading of files in C

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    1

    Stream reading of files in C

    Hi;
    I was wondering if C supports any kind of file reading through inputstreams as java does.I have some strange requirements of reading .doc,.xls and other non txt file formats through streams and pass those to servers so that they will get properly generated back to their original formats.
    please have some suggestions regarding this.
    Thanks;

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Look into fopen, fread/fwrite and fclose.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Sure, it's just fopen() and fclose() to open and close, then fgetc() in a loop to get the next byte from the file, one after another.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    And...cross-posted.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading from stream
    By shmitson in forum C Programming
    Replies: 2
    Last Post: 02-01-2011, 10:46 AM
  2. Reading mp3 stream metadata
    By naquad in forum C Programming
    Replies: 5
    Last Post: 06-24-2009, 12:04 PM
  3. Reading sbte stream to int
    By coop in forum C Programming
    Replies: 2
    Last Post: 04-02-2009, 12:57 PM
  4. help with reading from stream
    By movl0x1 in forum C Programming
    Replies: 7
    Last Post: 05-31-2007, 10:36 PM
  5. IRC, reading the stream
    By Iyouboushi in forum C# Programming
    Replies: 6
    Last Post: 08-03-2006, 05:34 PM