How to use a txt file as command line argument?
c#, command-line-arguments, console
Solution
If you intend to give your program data `program.exe < data.txt`, this is called reading from standard input. You can do this via .NET's Console.OpenStandardInput with
new StreamReader(Console.OpenStandardInput())
Alternatively, if you'd rather your program be run `program.exe data.txt`, start with
void Main(string[] args)
{
File.ReadLines(args[0])
}
Problem
I have a .txt file like this: 6 4 1 2 2 3 3 4 4 5 1 2 4 5 How can I use this as command line argument in C#?