system("CD"). Help please :(

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2009
Posts: 106
Reputation: jen140 is an unknown quantity at this point 
Solved Threads: 5
jen140 jen140 is offline Offline
Junior Poster

Re: system("CD"). Help please :(

 
0
  #11
Aug 7th, 2009
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 12
Reputation: licktress is an unknown quantity at this point 
Solved Threads: 0
licktress licktress is offline Offline
Newbie Poster

Re: system("CD"). Help please :(

 
0
  #12
Aug 7th, 2009
Originally Posted by jen140 View Post
Use strcat(), it is described at http://www.cplusplus.com/reference/c...string/strcat/

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?
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 106
Reputation: jen140 is an unknown quantity at this point 
Solved Threads: 5
jen140 jen140 is offline Offline
Junior Poster

Re: system("CD"). Help please :(

 
0
  #13
Aug 7th, 2009
The function i talked about is only used to work with strings that you already have, so if you need to mannualy add the space or other content to the given string you can use that function
If i'm not mistaken the user can introduce the string with space without any need to use other functions.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: system("CD"). Help please :(

 
0
  #14
Aug 7th, 2009
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:
  1. string dirpath;
  2. getline( cin, dirpath ); // gets everything, including spaces
Hope this helps.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,350
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1462
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Still Learning

Re: system("CD"). Help please :(

 
0
  #15
Aug 7th, 2009
Originally Posted by licktress View Post
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
You could have saved yourself a lot of time had you bothered to read the post I made over 10 hours ago
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC