+ 1
How can i read a text from a note pad in c or c#?
5 Antworten
+ 1
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.
}
}
string notepad = @"c:\oasis\B1.text";
//this must be Hello world
0
What do you mean by note pad ?
Do you want to read a file ?
0
Yes...
0
It is in System.IO
string value1 = File.ReadAllText("C:\\file.txt");
0
Thanks