Jump to content
  • Advertisement
Sign in to follow this  
monkeykid1313

File copy with progress bar

This topic is 540 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, I'm learning C++. I try to write this program but I have no idea how to do it.

 

"Write a program to copy a file byte-wise. It should take in two filenames as command-line arguments: the source file and the destination file. Furthermore, during the copy it should show a progress bar on a single line (print the carriage return \r to re-print a line). "

 

Is there any help? Thanks. 

Share this post


Link to post
Share on other sites
Advertisement

Threads only complicate things here, as the OP has yet to figure out how to do it sequentially.

 

Even if you know how to do that, you probably don't really need threads. Disk-speed is an order of magnitude slower than the CPU, and disk-cache read-ahead will make sure for ample supply of next data blocks. Maybe with an SSD that changes, but then a progress-bar makes no sense any more either :p

Share this post


Link to post
Share on other sites

There are OS-specific techniques that can potentially do it in the background without the data ever touching the CPU or other higher-performance patterns.

Based on the wording, it looks like something that could be accomplished in about 10 lines of code if you know what you are doing.  Open the files, find the length, read and write, update status. Rinse and repeat until done. Close the files.

 

I'm pretty sure I had the same assignment back in my college days.

Share this post


Link to post
Share on other sites

looks also like they told you something about threads ;)

 
what does threads have to do with this?

Yeah I'm sure they said to avoid them at all costs :D

Share this post


Link to post
Share on other sites
That's nice. But your post is not very useful by itself. Don't be lazy, and respect the time of the people who are here voluntarily helping you.

Did you test it?

Does it work?

Does it NOT work?

Can you break it?

How does it break?

Can you speculate as to why it might be broken?


Also, if this is homework, please keep in mind that site policy is that we do not help with homework. Ask your teacher/professor/mentor.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!