I/O with files, deleting.

This is a discussion on I/O with files, deleting. within the C++ Programming forums, part of the General Programming Boards category; I am making a small program that works on a file. I sometime need to delete a line of a ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    17

    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 11:09 AM.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,340
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 10:46 AM
  3. Overlapped I/O and Completion Port :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 10-30-2002, 04: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21