Author |
Message |
crossbow
|
Posted: 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 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
pjohnston
|
Posted: 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
|
Posted: 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
|
Posted: 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
|
Posted: 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. |
|
|
|
|
|
|