Edit text file.

  • Thread starter Thread starter Shawn
  • Start date Start date
S

Shawn

I need to be able to open a file, search for a line of text and change the
line. I am able to use the streamreader to find the line, but can seem to
find a way to alter the line.
 
Shawn said:
I need to be able to open a file, search for a line of text and change the
line. I am able to use the streamreader to find the line, but can seem to
find a way to alter the line.

AFAIK, You will need to open a streamwriter and write out the entire
file with your altered text.

Chris
 
steps to take

read the file in memory
alter the line
write the file back to disk ( overwite the original file for instance )

regards

Michel Posseth [MCP]
 
Michael,
read the file in memory
alter the line
write the file back to disk ( overwite the original file for instance )
I find that a dangerous operation, I advice forever first to rename the old
one (better put it in the temp), and after the succesful write delete that

:-)

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top