Program to "copy" a data file to a new file?

My professor gave us an assignment.

"Write a program to copy a data file "lab01.dat" to a new file "lab01.out"

The lab01.dat is just a link on his page. You click this link and its just a list of names. It's not an actual file that I can download.

So I just copied these names and saved it to a .txt file on my computer. And named it "lab01"

I am then supposed to "copy" this to a .out file but I don't know how.

I also don't understand what he means by COPY.

As far as I know, there are only three things you can do with a file: create, read, and write. I don't understand his use of the word "copy"

I don't understand what he's asking me to do.
Last edited on
sounds like to me he wants you to take the file, pull the information from the file and then move it to the other file.

erock
Last edited on
there are only three things you can do with a file
You forgot remove and rename (essentially, move)

create, read, and write
If you create new file, read old one and write its content in new file, you might say you copied it.
The lab01.dat is just a link on his page. You click this link and its just a list of names. It's not an actual file that I can download.

Usually if you right-click on a link you will get various options (depending on which browser you use), such as "Save link as" (Firefox) or "Save target as" (Internet Explorer). It is better to do this, rather than copy+paste the text displayed on the screen, because it works for any type of file such as jpg images or mp3 sounds.

Note: when you do this, you will have created a COPY of the file on your own computer. Now you just need to write a program to duplicate the file so you have two identical files.
Last edited on
There are many ways to copy. For examples, websearch "C++ FileIO Copy stack".
Registered users can post here. Sign in or register to post.