| | |
system("CD"). Help please :(
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2009
Posts: 106
Reputation:
Solved Threads: 5
Use strcat(), it is described at http://www.cplusplus.com/reference/c...string/strcat/
•
•
Join Date: Aug 2009
Posts: 12
Reputation:
Solved Threads: 0
I apologise profusely, but i am a newby at programming.
Does that also allow the user to input values with spaces in them? The example given is only a string that has been given a value by the program.
And if so, how?
You don't need to use strcat()... Please don't suggest using the C string library to manipulate C++ strings.
AD already addressed your question. You should be using getline() to get user input:
Hope this helps.
AD already addressed your question. You should be using getline() to get user input:
C++ Syntax (Toggle Plain Text)
string dirpath; getline( cin, dirpath ); // gets everything, including spaces
•
•
•
•
Okay, it works now, however, if the string has any spaces in it, it doesn't work.
Does anyone know how to add spaces to a string variable?
Thanks for all the help
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- System 32 at startup and "dwn"/"down" pop up at startup (Viruses, Spyware and other Nasties)
- System 32 at startup and "dwn"/"down" pop up at startup (Viruses, Spyware and other Nasties)
- "Invalid" system disk...." (Storage)
- System 32 at startup and "dwn"/"down" pop up at startup (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: Define abstart overridable method
- Next Thread: exercise on recursion...
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock wordfrequency wxwidgets







