Tuesday, 19 August 2014

Get text file and its contents in c#.


string s = Path.GetPathRoot(Environment.SystemDirectory);
// Read the file as one string.
System.IO.StreamReader myFile = new System.IO.StreamReader(s + "Test.txt");
string myString = myFile.ReadToEnd();
string[] newString = myString.Split('\n');
myFile.Close();
MessageBox.Show(myString);

No comments:

Post a Comment