C# Console.Write print out in text file? -
can make code print out in text file using console.write ?
console.write(" enter id: "); int id = int.parse(console.readline()); console.write(" enter name: "); string name = console.readline(); console.writeline(" thank you! logged in as" +name+ +id);
please help!
thanks in advance.
i don't know why need write in file in particular case if want console.writeline
write in file may use console.setout(sw);
console.writeline("hello world"); filestream fs = new filestream("test.txt", filemode.create); streamwriter sw = new streamwriter(fs); console.setout(sw); console.writeline("hello file"); sw.close();