Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Dev
Its been a long time i wrote my codes in C++ and i've forgotten many things. Pls can some1 help me with how i can read a single string containing white spaces from standard input, without having to form a loop for this; something like a name (''James Berk Brown''). Pls any respond would be appreciated. 10x
Posted 20-Sep-12 22:05pm
Comments
Mohibur Rashid at 21-Sep-12 4:35am
   
did you check google?
Emejulu JVT at 21-Sep-12 4:46am
   
yes i did but i didn't see stuffs that matched the specific
Andrewpeter at 21-Sep-12 4:59am
   
You search with words "how to use scanf in C++". Good luck!

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

'getline' is the function you are looking for.
 
http://www.cplusplus.com/reference/string/getline/[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 370
1 Sergey Alexandrovich Kryukov 195
2 Prakriti Goyal 177
3 jlopez788 134
4 _Amy 110
0 OriginalGriff 6,762
1 Sergey Alexandrovich Kryukov 5,539
2 Maciej Los 3,479
3 Peter Leow 3,323
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100