first cannot conver std::string to const char, now runtime error!

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: first cannot conver std::string to const char, now runtime error!

 
2
  #21
Sep 25th, 2006
Not sure whether it would work for TurboC and the old command.com shell, but you could try creating the command using double quotes to handle filenames with spaces. Don't know what will happen for long file names though.

e.g.
copy "c:\yserver.txt" "c:\documents and settings\luffy-san\desktop\tcp1241_assignment3\lecture notes\server.txt"
バルサミコ酢やっぱいらへんで
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: first cannot conver std::string to const char, now runtime error!

 
0
  #22
Sep 25th, 2006
Mmm
  1. $ dir
  2. Volume in drive C has no label.
  3. Volume Serial Number is F8A8-3449
  4.  
  5. Directory of C:\temp
  6.  
  7. 25/09/2006 19:00 <DIR> .
  8. 25/09/2006 19:00 <DIR> ..
  9. 25/09/2006 18:58 2 my long filename.txt
  10. 1 File(s) 2 bytes
  11. 2 Dir(s) 13,895,516,160 bytes free
  12.  
  13. $
  14. $ copy "my long filename.txt" test.txt
  15. 1 file(s) copied.
  16.  
  17. $ command.com
  18. Microsoft(R) Windows DOS
  19. (C)Copyright Microsoft Corp 1990-2001.
  20.  
  21. $ copy "my long filename.txt" test2.txt
  22. 1 file(s) copied.
  23.  
  24. $ exit
Maybe it's just enough if you surround the long filename with double quotes.
But bear in mind that command.com also has a limit (like 128 characters) on the length of any command line, so there could still be problems.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,617
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 466
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: first cannot conver std::string to const char, now runtime error!

 
0
  #23
Sep 25th, 2006
Originally Posted by WolfPack View Post
Not sure whether it would work for TurboC and the old command.com shell, but you could try creating the command using double quotes to handle filenames with spaces. Don't know what will happen for long file names though.

e.g.
copy "c:\yserver.txt" "c:\documents and settings\luffy-san\desktop\tcp1241_assignment3\lecture notes\server.txt"
Yep it works. Dont know where you found out about this one but this sure is informative, hats off (and of course rep)to you.

Your friend,

~s.o.s~
Last edited by ~s.o.s~; Sep 25th, 2006 at 3:13 pm.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: first cannot conver std::string to const char, now runtime error!

 
0
  #24
Sep 26th, 2006
Originally Posted by ~s.o.s~ View Post
Dont know where you found out about this one
Nothing like getting bitten once or twice while writing a bat(cmd) script.
バルサミコ酢やっぱいらへんで
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 20
Reputation: n3st3d_l00p is an unknown quantity at this point 
Solved Threads: 0
n3st3d_l00p's Avatar
n3st3d_l00p n3st3d_l00p is offline Offline
Newbie Poster

Re: first cannot conver std::string to const char, now runtime error!

 
0
  #25
Sep 26th, 2006
wahhh!! thanks again.. actually i'm using dev cpp compiler 4.9.9.2 .. a 32 bit compiler right?

the output screen tweaked with system("color 1F");
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: first cannot conver std::string to const char, now runtime error!

 
0
  #26
Sep 26th, 2006
> actually i'm using dev cpp compiler 4.9.9.2 .. a 32 bit compiler right?
Yes it is.

So just using double quotes should be good.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
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