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 554
1 Gihan Liyanage 338
2 RyanDev 258
3 Sergey Alexandrovich Kryukov 248
4 ChauhanAjay 220
0 Sergey Alexandrovich Kryukov 8,936
1 OriginalGriff 7,891
2 CPallini 2,603
3 Richard MacCutchan 2,121
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web01 | 2.8.140827.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