Deleting Blocks of Text From a File

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

is there a way to delete a block of text

i have started by looking for the speicific line of text that starts the
block by looking for teh index of it...but i cannot figure out out to remove
that text from the file..can anyone help me?
 
Thaynann said:
is there a way to delete a block of text

i have started by looking for the speicific line of text that starts the
block by looking for teh index of it...but i cannot figure out out to
remove
that text from the file..can anyone help me?

Copy the file, skipping the part you want to delete.

Or if you are going to delete a lot of stuff, keep track of all the
deletions in a sorted list and do them in a single copying operation.
 
thanx

i thaought about doing that, just reading the entire file to a string,
removing the block i dont need and then writing that block to a new file
(with the same name) and deleting the other file...but that seems to more
resources then needed..and im running this app on a Pocket PC, so my
resources are liminted as is.
 
Thaynann said:
thanx

i thaought about doing that, just reading the entire file to a string,
removing the block i dont need and then writing that block to a new file
(with the same name) and deleting the other file...but that seems to more
resources then needed..and im running this app on a Pocket PC, so my
resources are liminted as is.

Of course, you do not have to read the whole file into a string before
outputting any of it. That would require a lot of memory. Read individual
characters or small blocks of characters and write them out.
 
Back
Top