how to move a string or whole statement from one text file to another using C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jitupatil2007
    New Member
    • Mar 2008
    • 6

    how to move a string or whole statement from one text file to another using C#

    hi friends can anyone suggest me any method or function in C#.Net for moving a whole string from one text file to another text file. or moving a statement from one text file to another text file.. any help is appreciated please.......
  • Mr Gray
    New Member
    • Apr 2008
    • 47

    #2
    Using the StreamReader and possibly TestReader classes in the System.IO namespace can help.

    Code:
                StreamReader sr = new StreamReader("c:\textSource.txt");
                StreamWriter sw = new StreamWriter("c:\textDestination.txt");
    
                sw.Write(sr.ReadToEnd());

    Comment

    Working...