• Advertisement
Sign in to follow this  

[solved] ReadConsole

This topic is 4507 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

I'm trying to use ReadConsole, but the result is always madness!! #define MAX_INPUT 256 ReadConsole( hInputConsole, szInput, MAX_INPUT, NULL, NULL ); When i WriteConsole szInput, it just looks like a bunch of =======================================22222 or something. is there something strange to know about ReadConsole, or is there a better Win32 function out there? SOLVED: the fourth parameter can't be NULL

Share this post


Link to post
Share on other sites
Advertisement
Do you null out the buffer before calling ReadConsole()?

Share this post


Link to post
Share on other sites
that helped a bit. i nulled szInput, but it just came out null, so apparently i'm putting something wrong into ReadConsole. i'll try to figure that out.

Share this post


Link to post
Share on other sites
It looks like ReadConsole() is failing. I believe this is because the lpNumberofCharsRead parameter should not be NULL.

Share this post


Link to post
Share on other sites
Quote:
Original post by Yohomyth
Is there something strange to know about ReadConsole, or is there a better Win32 function out there?


This might not be suited to your program, but whenever I need to use the console, I declare two std::fstreams:


std::ifstream conin("CONIN$");
std::ofstream conout("CONOUT$");


Which achieves the same result, but using the STL. It results in me having to do less work, which is always good [grin].

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement