New to C# and want to implement below reading from input.txt and write result to output.txt
myprogram.exe < input.txt > output.txt
my code as below
class Program
{
static void Main(string[] args)
{
String line = Console.ReadLine();
while(line != null)
{
Console.Out.WriteLine(line);
line = Console.ReadLine();
}
}
}
The result is reading from input.txt is fine, and output.txt can be created but nothing in it.
UPDATE: the rootcause is output.txt been locked by other process which is not C# language related.