I need Console Application in C# which may open a .txt file like a parameter. I know only how to open a .txt file from root.
var text = File.ReadAllText(@"Input.txt");
Console.WriteLine(text);
I need Console Application in C# which may open a .txt file like a parameter. I know only how to open a .txt file from root.
var text = File.ReadAllText(@"Input.txt");
Console.WriteLine(text);
A starting point. Then what you want to do with the contents of the file is up to you
the above approach reads one line at a time to process the minimal quantity of text, however, if the file size is not a concert you could avoid the StreamReader object and use
here is a basic console aplication :
The parameter args of the method Main is what you need, when you launch your program from a console you type in your program name and next to it your parameter( here the path to the txt file) Then to get it from the program just get it by args the first parameter is args[0] .
I hope it will help you