How to print out to console in Visual Studio Express?
Ravenclaw

I tried using

cout << "Hello";

but this does not print anything.

DanielH

Could be that you didn't RTFM!

It is probably due to the fact that you are compiling a windows app and not a console app. Maybe?

I'ts like saying 'I tried building a WOODEN box with PLASTIC parts!'

Ravenclaw

I didn't pose the question correctly, sorry about that. I don't want to create a console app, but I want to create a normal allegro app and print out to the output window of Visual Studio (not the windows console). Is that possible?

Hard Rock

Try ATLTRACE(), it works like printf.

axilmar

Look up the definition of OutputDebugString function in MSDN.

I always wondered why Microsoft IDEs don't capture stdout and stderr like all other environments.

But what am I saying...you can't expect otherwise from the company that introduced WinMain.

Ravenclaw

Thanks!

I also found an alternative:

freopen("file.txt", "w", stdout);

This will redirect all standard output to the file "file.txt". So every time you make a cout call, the output goes to the file. Each subsequent call appends to the file.

HoHo

... and if you install some unix tools on your windows you can watch the file change in realtime with #tail -f :)

count
Quote:

some unix tools

What tools would that be? Sounds interesting.

HoHo

I think it was msys from mingw homepage. Either that or something that came with KDE4-windows alpha packages.

count

Thanks. Will check this out.

Thread #593080. Printed from Allegro.cc