Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

UeberBobo

console window from win32

This topic is 5250 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
When the window isn''t active, make your app sleep.

As for the console thing, use AllocConsole

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Try


//Open console

if (AllocConsole ())
{
freopen ("CONIN$", "rb", stdin);
freopen ("CONOUT$", "wb", stdout);
freopen ("CONOUT$", "wb", stderr);
}

/*Just use it C-style*/
printf ("Hello world!");

//Or C++-style

cout << "Foo!" << endl;

//Release console

fclose (stdin);
fclose (stdout);
fclose (stderr);
FreeConsole ();


Share this post


Link to post
Share on other sites
quote:
Original post by Kippesoep
Try


//Open console

if (AllocConsole ())
{
freopen ("CONIN$", "rb", stdin);
freopen ("CONOUT$", "wb", stdout);
freopen ("CONOUT$", "wb", stderr);
}

/*Just use it C-style*/
printf ("Hello world!");

//Or C++-style

cout << "Foo!" << endl;

//Release console

fclose (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. }

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!