Advertisement

inputting characters

Started by June 04, 2001 06:52 PM
0 comments, last by gph-gw 23 years, 8 months ago
I''m using plain iso c/c++, i''ve tried getchar, scanf, and cin, but it doesn''t accept spaces, eg: type in "test", it prints out test on a new line, but if I input "te st"(no quotes, of course), it outputs te, the prompt I put in, and then st. The only exception is when I get the chars one at a time, it crashes(Segmentation fault, I''m using linux). What''s going on?
try using gets()

or getline()

that will get the entire line ..
Remember to add the null terminator at the end..



{ Stating the obvious never helped any situation !! }

This topic is closed to new replies.

Advertisement