Thread: File streaming

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    40

    File streaming

    is there a way to edit a file without having to store the whole file into a buffer then edit then write back to the file??

    kind of like the overwriteing a word or line??

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    If the word or line after you change it is the same size as the original value, then you can do it.

  3. #3
    The Reel Thing
    Join Date
    Jun 2005
    Posts
    44
    I'm afraid not, for the program to do something you've got in mind, the program must have the whole file in memory. Then again, I'm not an expert, and never tried this, so I could be wrong..
    Bagpipes – putting the fun back in funeral.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > is there a way to edit a file without having to store the whole file into a buffer then edit then write back to the file??
    Like for example 'sed', which reads in a line, decides what to do about it based on a bunch of rules you specify, then optionally writes out a (modified) line.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  3. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  4. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 10:57 AM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM