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

Username:   Password: 
 RegisterRegister   
 moving files
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ReN3g@de




PostPosted: Sat Feb 28, 2004 7:42 pm   Post subject: moving files

ok i made a c++ program that does matrix code stuff... now i was wondering if its possible to make a turing program that will simply move the exe file into another directory... i am goin to zip this program and the c++ one together.
Sponsor
Sponsor
Sponsor
sponsor
shorthair




PostPosted: Sat Feb 28, 2004 7:45 pm   Post subject: (No subject)

there are commands in turing that start with

Flie.*******

just f9 file in turing and it should give you all the little things it can do, you can do exactly what you want it to
Tony




PostPosted: Sat Feb 28, 2004 8:41 pm   Post subject: (No subject)

shorthair - enough with the spamming. Telling people to look up the answer themselves is not the best way to go Rolling Eyes

so to answer the question.
File.Copy (srcPathName, destPathName : string)
copies the file from srcPathName to destPathName. The destanation defaults to the current folder unless specified by the full path. Remember that you've got to use \\ (or /) in between folders.

you would then use File.Delete (filePathName : string) to delete the original file so it would be moved.

It is important to check if the copy was successful so that you dont lose the file.
code:

var fileNameOld : string := "c:\\turing\\old.t"
var fileNameNew : string := "c:\\notTuring\\new.t"

File.Copy (fileNameOld, fileNameNew)
if Error.Last = eNoError then
    put "File copied"
    File.Delete (fileNameOld)
else
    put "Did not copy the file."
    put "Error: ", Error.LastMsg
end if
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
shorthair




PostPosted: Sat Feb 28, 2004 8:51 pm   Post subject: (No subject)

i thought we were trying to teach people how to use the turing referance, instead of asking silly questions , but if you would prefer it to be different thats alright with me ,
Tony




PostPosted: Sat Feb 28, 2004 9:02 pm   Post subject: (No subject)

turing reference will take you only this far Rolling Eyes you know it as well as I do that its not the best place to look for answers... and oftentimes their example code doesn't even work Laughing

With turing reference you just lookup the syntax for parameters of the commands you already know. If you dont know the command, and expecially if you're required more then 1 of them for a given task (such as copy+delete to "move) reference is no help
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Superskull85




PostPosted: Tue Apr 17, 2007 5:36 pm   Post subject: RE:moving files

I get how to move a file (Copy then delete the file), but if, for example, I want to move a file to a removable device, like an iPod or PSP, is there anyway to find the drive the device is using. I want my program to be as user friendly as possible, so simply asking them for the drive their device is in wouldn't be to user friendly for people who don't know much about Windows based computers. Also the name of the drive would probably not always be named "Removable Disk" for what I want to do.
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  [ 6 Posts ]
Jump to:   


Style:  
Search: