Thread: I/O with files, deleting.

  1. #1
    Registered User
    Join Date
    Mar 2005

    I/O with files, deleting.

    I am making a small program that works on a file. I sometime need to delete a line of a peice of the file.

    I checked many pages and tutorial, but it seems none had my problem before...

    How can I, for example delete from the char 1000 to the char 1200 of a opened file?

    Thanks in avance.

    Edit: I'd prefere avoiding to load the whole file in RAM, modify it as array of char and rewrite it, since I may need to open big files.
    I'll do only if there are no other ways...
    Last edited by Ezzetabi; 03-23-2005 at 12:09 PM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    By opening another file for writing, which you copy all the characters you want to keep.
    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. File I/O - Hash files
    By I BLcK I in forum C++ Programming
    Replies: 3
    Last Post: 04-29-2009, 01:30 AM
  2. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 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. Deleting files.
    By Paninaro in forum C Programming
    Replies: 5
    Last Post: 06-19-2002, 01:22 AM
  5. deleting files not in fstream?
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 10-09-2001, 01:36 PM