PDA

Click to See Complete Forum and Search --> : No output from Console.WriteLine


El-Phantasmo
Sep 8th, 2002, 06:23 PM
Ok I have an app that I run from either GUI or console...

For some reason the following line will NOT output anything :(

Console.WriteLine("some stuff")

I can get console arguments just fine, so it knows its coming from console, but it simply will not output anything.
I know its in teh right spot because I can call a message box right after the .writeline statement.

I've also tried Console.Write and although it doesn't matter System.Console.WriteLine and nothing gives me any output at all..

This doesn't seem like a difficult problem, but I don't get any errors so its a little more difficult to track down the problem.

I've even put the following line into the code, with no help
System.Console.SetOut(Console.Out)

Any ideas?
:confused:

SAS-Trooper
Sep 8th, 2002, 07:22 PM
When you write Console.WriteLine("This Text") it will output the result to the debug window.

But are you talking about the command console? <MSDOS looking thing> I'll assume thats what you mean, you output text like this

Console.Out.WriteLine("This Text")

El-Phantasmo
Sep 8th, 2002, 10:20 PM
:confused:


Console.Out.WriteLine("To Add a server to the scan list")
Console.Out.WriteLine("//a ServerName [Domain Name]")
Console.Out.WriteLine("To Remove a server to the scan list")
Console.Out.WriteLine("//r ServerName")
Console.Out.WriteLine("To scan for netstat information on servers")

and I get nothing :mad:

*sigh* just don't get it :(

I've also tried with and w/o the
'System.Console.SetOut(Console.Out)
line although I get the idea its not doing anything :rolleyes:

btw, this is running from the compiled version not debug mode.

--- edit ---

Works!! :rolleyes:
had to set output to console application
GUI part of it still seems to work ok.. anybody know what the limitations would be?

El-Phantasmo
Sep 8th, 2002, 11:01 PM
ok just found the limitation...
When I run the application normally it still pops up with command prompt and immediately goes into the GUI...

SO

How do I change standard output at runtime?

Thanks :)

Cander
Sep 9th, 2002, 08:32 AM
change the compile target from winexe to exe.

El-Phantasmo
Sep 9th, 2002, 03:25 PM
That's sounding like a compile time deal..

I just need it to be able to output to console when run from command line, but when you double click on the application I don't want the command prompt opening up first... just open the application. Wouldn't that be something that would require a runtime change?

Cander
Sep 9th, 2002, 03:45 PM
sorry but i dont think you can have it both ways.. At least not to my knowledge.