Click here to Skip to main content
16,017,249 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Being fairly new to C# I have a program that I have written as a console application that compares the files in a couple of folders named BASE folder and INPUT folder.

The output is displayed in the Console on the screen via the Console.WriteLine command.

What I want to be able to do is to output the results of the search to a text file so that I can print the results

Any tips for doing this would be really appreciated
Posted
Updated 20-May-10 20:50pm
v2

1 solution

You may use the StreamWriter class, see the sample code in the documentation page [^].

You may also leave the application as it stands and redirect the output on calling the executable.
For instance, suppose your application's name is mycomp.exe, then issuing
mycomp.exe > result.txt

will redirect the output of your program to the result.txt text file.
:)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900