textFile Manipulation

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

Guest

I have a textfile with multiple line. How do i get (for example) the 1st line
or the 3rd line then change the line to something i want in C#? How do i
delete a line in C#... or backspace in a textfile? for example

1st line
2nd line
3rd line
4th Line

I want to read the 2nd line and change the string 2nd line to string 4th
line. Anyone knows how to do this? Or i want to Delete 2nd line and move up
3rd and 4th line so there will be no space.. i need the code to do this..
does anybody have the idea? thank you so much!
 
you can make a string array and load the all the lines to this array and
then change the array as you want and then rewrite it to the file.
 
Hi

You will have to read all the lines in either an Array or an ArrayList (
preferred ) and change them at will, after you are done you can just write
the lines back to disk
 

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