Sign in to follow this  

C++ console

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

in a C++ console on a windows system does anyone know how to get the chacter printed to the console right away insted of after enter is pushed im trying to create a way of being able to enter data to a console wile another threade wirtes to it, it will delet whats the user has writen then print what it wants and restores what was there originaly there from the user if anyone knows a better way to write to the console while a user is typeing without breaking up the message that would be appresheated

Share this post


Link to post
Share on other sites
You need to flush the output stream. If you use std::cout to print then try sending the flush manipulator. Something like this:
std::cout << "My number: " << myNum << std::flush;

If you're just using the C functions then try calling fflush().
fprint("My number: %d",myNum);
fflush(stdout);

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by ace_lovegrove
if ( a >= 1)
{
character = getch();
}


is getch() in iostream or do you need to include another header?

Share this post


Link to post
Share on other sites
for kbhit and getch it says error C2065: 'getch' : undeclared identifier but it knows the paramtes and list the function when i click list members, so it seems to knows the function exist but says it dosent when i try to compile

Share this post


Link to post
Share on other sites

This topic is 4751 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this