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

Username:   Password: 
 RegisterRegister   
 how to make a turing program that copys a file several times automatically?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
crossbow




PostPosted: Fri Jan 14, 2011 11:38 pm   Post subject: how to make a turing program that copys a file several times automatically?

hi there, Im trying to make a turing program that copys a file(or the file itself) many times by using a loop or for, and put them into my disk(F disk)
so any suggestions for me?
thanx Smile
Sponsor
Sponsor
Sponsor
sponsor
pjohnston




PostPosted: Sat Jan 15, 2011 12:11 am   Post subject: Re: how to make a turing program that copys a file several times automatically?

So, you want to make a large number of copies of a single file, and write them all to the same place? We can help better if we know what the end goal of your program is. If it's to fill the destination with garbage, we can't recommend that.
TokenHerbz




PostPosted: Sat Jan 15, 2011 12:47 am   Post subject: RE:how to make a turing program that copys a file several times automatically?

ofcourse we could...
Carey




PostPosted: Sat Jan 15, 2011 12:38 pm   Post subject: RE:how to make a turing program that copys a file several times automatically?

Just use a for loop (or a loop with a counter) to copy the file, but add the iterator to the end of the filename.

@pjohnston: Why not? Pretty much all code can be used for both good and evil.
DemonWasp




PostPosted: Sat Jan 15, 2011 1:57 pm   Post subject: RE:how to make a turing program that copys a file several times automatically?

1. Open a stream for read (binary input) from the file you are copying FROM.

2. Open a stream for write (binary output) to the file you are copying TO. This file doesn't need to exist beforehand.

3. While there are still bytes waiting to be read from the input stream, read the byte and output it to the output stream.

4. Close the input and output streams.

5. Abstract the above into a procedure that takes the two filenames and then performs the copy.
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: