Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Using Sys.Exec with spaces
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
LegendsEnd




PostPosted: Mon May 22, 2006 7:11 pm   Post subject: Using Sys.Exec with spaces

Using the Sys.Exec command, can the file I'm trying to run have spaces? If so, am I supposed to put an asterisk somewhere?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon May 22, 2006 8:01 pm   Post subject: (No subject)

I'm think that it has to be in quotations, like
code:

Sys.Exec("\"documents and settings\file\"")
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
LegendsEnd




PostPosted: Mon May 22, 2006 8:26 pm   Post subject: (No subject)

I'm confused as to what you're saying. Right now I have code that looks like this:
code:

if not Sys.Exec("A Document.doc") then
put "Failed"
end if


When I try it as "ADocument.doc" it works, with the space however it doesn't.
I have tried "A" + chr(32) + "Document.doc" which doesn't work, I have also tried making a string that stores "A Document.doc" and using that as the parameter but it doesn't work either.
[Gandalf]




PostPosted: Mon May 22, 2006 8:59 pm   Post subject: (No subject)

Tony is using an escape character: \ to add a quote to the argument. If you don't understand this, I'd suggest looking the subject up specifically (ie. escape characters).
We need a quote in the argument since without it the console will take "A" and "Document" as two seperate arguments because they are split up by a space. When you put quotes around the whole argument, you are telling the console that it is all one big argument: "A Document".
LegendsEnd




PostPosted: Mon May 22, 2006 9:24 pm   Post subject: (No subject)

Ah I see, thanks, got it working. Forgot that the \ allows characters like " ' ^
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: