string question

H

Huub

Hi,

I try to read a string command from commandline using cin.getline
(command, 14). This works fine, but somehow there's some input given
before the first command is typed in. I know this because there's already
response while it should be waiting for the first command. How can I make
sure this doesn't happen?

Thanks
 
O

osmium

Huub said:
I try to read a string command from commandline using cin.getline
(command, 14). This works fine, but somehow there's some input given
before the first command is typed in. I know this because there's already
response while it should be waiting for the first command. How can I make
sure this doesn't happen?

Use ios::ignore() before the query for response.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top