Notepad:
Hello world!
How I'll put it in C# and convert it into string..?
So far, I'm getting the path of the notepad.
string notepad = @"c:\oasis\B1.text"; //this must be Hello world
Please advice me.. I'm not familiar on this.. tnx
You can read text using the File.ReadAllText()
method:
public static void Main()
{
string path = @"c:\oasis\B1.txt";
try {
// Open the file to read from.
string readText = System.IO.File.ReadAllText(path);
Console.WriteLine(readText);
}
catch (System.IO.FileNotFoundException fnfe) {
// Handle file not found.
}
}