console window from win32

Started by
5 comments, last by UeberBobo 20 years, 4 months ago
can i somehow print things out in a console window from a win32 window. also how do i avoid using up all CPU when using a PeekMessage messageloop. i thought about setting a maximum FPS, would that work? i dont want to change my messageloop
//---------//Ueberbobo//*********
Advertisement
When the window isn''t active, make your app sleep.

As for the console thing, use AllocConsole

can you give me an example as to how this works? i managed to get the window up with AllocConsole() but i dont know how to write or read aything from it.. how do i get it to print out some text?
//---------//Ueberbobo//*********
Try

//Open consoleif (AllocConsole ()){  freopen ("CONIN$", "rb", stdin);  freopen ("CONOUT$", "wb", stdout);  freopen ("CONOUT$", "wb", stderr);}/*Just use it C-style*/printf ("Hello world!");//Or C++-stylecout << "Foo!" << endl;//Release consolefclose (stdin);fclose (stdout);fclose (stderr);FreeConsole ();


Kippesoep
This place should have everything you''ll need to know

Colin Jeanne | Invader''s Realm
quote:Original post by Kippesoep
Try

//Open consoleif (AllocConsole ()){  freopen ("CONIN$", "rb", stdin);  freopen ("CONOUT$", "wb", stdout);  freopen ("CONOUT$", "wb", stderr);}/*Just use it C-style*/printf ("Hello world!");//Or C++-stylecout << "Foo!" << endl;//Release consolefclose (stdin);fclose (stdout);fclose (stderr);FreeConsole ();




Do we need to include iostream/stdio?


It''s Maxd Gaming, put in an underscore and I will beat you with a rubber ducky!
{ Check out my Forum } { My First Space Art (Ever) }{ My Second Space Art (Ever) }{ My upcoming space mod for Battlefield: 1942. }
The Untitled RPG - |||||||||| 40%Free Music for your gamesOriginal post by capn_midnight 23yrold, is your ass burning from all the kissing it is recieving?
quote:Original post by maxd gaming
Do we need to include iostream/stdio?


Obviously...

Kippesoep

This topic is closed to new replies.

Advertisement