Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » How to print out to console in Visual Studio Express?

This thread is locked; no one can reply to it. rss feed Print
How to print out to console in Visual Studio Express?
Ravenclaw
Member #9,022
September 2007

I tried using

cout << "Hello";

but this does not print anything.

DanielH
Member #934
January 2001
avatar

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
Member #9,022
September 2007

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
Member #1,547
September 2001
avatar

Try ATLTRACE(), it works like printf.

_________________________________________________
Hard Rock
[ Stars Dev Company ][ Twitter ][Global Warming: ARA My TINS 07 Entry][Pong Ultra Website][GifAllegS Ver 1.07]
"Well there's also coolwebsearch but we'll let that be an IE exclusive feature" - arielb on the New Browser Plugins "What's better, HTML or Variables?"

axilmar
Member #1,204
April 2001

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
Member #9,022
September 2007

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
Member #4,534
April 2004
avatar

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

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

count
Member #5,401
January 2005

Quote:

some unix tools

What tools would that be? Sounds interesting.

HoHo
Member #4,534
April 2004
avatar

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

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

count
Member #5,401
January 2005

Thanks. Will check this out.

Go to: