Stream problem

  • Thread starter Thread starter csharpula csharp
  • Start date Start date
C

csharpula csharp

Hello,
I am using the following code in COnsole C# application:
TextWriter tw = new StreamWriter(LogFileName);
while ((inputLine = _streamReader.ReadLine()) != null)
{
lineNumber++;
if (lineNumber > ReadLines)
{
tw.WriteLine(inputLine);

}
}
The problem is that the output is written in file and in console and I
want it to be written in file only. How can I avoid it be written to the
console?

Thank u!
 
csharpula csharp said:
I am using the following code in COnsole C# application:
TextWriter tw = new StreamWriter(LogFileName);
while ((inputLine = _streamReader.ReadLine()) != null)
{
lineNumber++;
if (lineNumber > ReadLines)
{
tw.WriteLine(inputLine);

}
}
The problem is that the output is written in file and in console and I
want it to be written in file only. How can I avoid it be written to the
console?

On its own, that's very unlikely to write to the console.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
 
Is this the only code in your console application?
I suspect some other code before this must be writing to the console

Kalpesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top