| View previous topic :: View next topic |
| Author |
Message |
igoticecream Grandmaster Cheater Supreme
Reputation: 0
Joined: 23 Apr 2006 Posts: 1807 Location: 0x00400000
|
Posted: Fri Jan 22, 2010 3:12 pm Post subject: Command argument problem |
|
|
Hi, i'm coding a small app with visual c++ that recieve a directory as an argument for later do the work, so i run it with cmd like: >app.exe C:\Program Files
now here comes to problem, i want "C:\Program Files" be on argv[1] and i get argv[1] = C:\Program and argv[2] = Files... does anyone know how to fix this problem?
_________________
+~ |
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Jan 22, 2010 4:23 pm Post subject: |
|
|
| put the path in quotes
|
|
| Back to top |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Fri Jan 22, 2010 6:01 pm Post subject: |
|
|
i think you have to use double \'s if i remember correctly..
like...
| Code: | | "C:\\Program Files\\WhateverUWant\\app.exe" |
_________________
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Jan 22, 2010 6:07 pm Post subject: |
|
|
| manc wrote: | i think you have to use double \'s if i remember correctly..
like...
| Code: | | "C:\\Program Files\\WhateverUWant\\app.exe" |
|
you don't. that is a separate thing, breaking out of control characters
|
|
| Back to top |
|
 |
igoticecream Grandmaster Cheater Supreme
Reputation: 0
Joined: 23 Apr 2006 Posts: 1807 Location: 0x00400000
|
Posted: Sat Jan 23, 2010 1:46 am Post subject: |
|
|
| manc wrote: | i think you have to use double \'s if i remember correctly..
like...
| Code: | | "C:\\Program Files\\WhateverUWant\\app.exe" |
|
No, i get it right if i use a non-whitespace path.
Thanks Slugsnack, now it work
_________________
+~ |
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Sat Jan 23, 2010 4:42 am Post subject: |
|
|
Just a sidenote if you need, to escape a quote from command line, use double quotes: | Code: | | "value with whitespace=""hello""" | so it becomes | Code: | | value with whitespace="hello" |
|
|
| Back to top |
|
 |
|