I want to execute a shell command (I want to touch
a file). I use system("shell command")
to execute the command.
For example I want to touch the file at path /Users/username/New Folder/
. Now I need to convert the NSString
in a format that is conform to shell commands like /Users/username/New\ Folder
.
Is there any method that does a conversion like this?
NOTE: It is NOT just replacing a whitespace with \
. If you have a special character in the path like /Users/username/Folder(foo)/
the "shell path" looks like this /Users/username/Folder\(foo\)/