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

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




PostPosted: Thu Apr 07, 2011 6:33 pm   Post subject: : * problems with Sys.Exec

Turing:

var filename : string
get filename : *
if not Sys.Exec (filename) then
    put "Error, " ..
    put Error.LastMsg
end if


why won't it let me put spaces for this? and is there a way to put spaces here
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Thu Apr 07, 2011 6:43 pm   Post subject: RE:: * problems with Sys.Exec

Open up Command Prompt and type a filename with spaces. It'll error out.

In order to do that you need to surround the filename with quotes ("").
goroyoshi




PostPosted: Thu Apr 07, 2011 6:47 pm   Post subject: RE:: * problems with Sys.Exec

but while using variables?
Tony




PostPosted: Thu Apr 07, 2011 7:26 pm   Post subject: RE:: * problems with Sys.Exec

The variable is fine
code:

var filename : string
get filename : *
put filename


but commands are delimited by whitespace, so it's not valid to have spaces in filenames.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
goroyoshi




PostPosted: Fri Apr 08, 2011 11:03 am   Post subject: RE:: * problems with Sys.Exec

some of my folders have spaces, so this will be a problem
DemonWasp




PostPosted: Fri Apr 08, 2011 12:40 pm   Post subject: RE:: * problems with Sys.Exec

In Windows, there's a way to specify a folder name that has spaces in it without including spaces in the path. In fact, there are two ways.

First, you can put double-quotes around the path. Some programs that do naive parsing have a problem with this, wherein they ignore the quotes, or worse, decide that the quotes are part of the path.

Second, you can use the "short form" of a file name, as these are guaranteed to never contain spaces, and uniquely determine a longer "user-friendly" file name. To find out the short form, you can use dir /x in the parent directory, assuming you know the path ahead of time. Using this strategy, "C:\Program Files\" becomes "C:\PROGRA~1\". If you don't know the path ahead of time, you can't really use this approach.
Raknarg




PostPosted: Fri Apr 08, 2011 3:26 pm   Post subject: RE:: * problems with Sys.Exec

If the file you're calling is in the same folder as the turing save, you should only need to put the name of that file.
goroyoshi




PostPosted: Sat Apr 09, 2011 2:22 pm   Post subject: RE:: * problems with Sys.Exec

quotes worked thank you

+1 karma to Zren
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: