Click here to Skip to main content
Licence 
First Posted 5 Feb 2007
Views 20,457
Downloads 390
Bookmarked 13 times

Binary File Copy

By | 5 Feb 2007 | Article
A C++ program to read/write files in binary mode.

Filename : BinaryFileIO.cpp

Author : Pawan Pillai

Description : A C++ program to read/write files in binary mode.
The user itself specifies the number of bytes to be read,
and the code runs a loop until the whole file is copied
at the destination.

Cool points:

1) uses loop to read andd write the bytes, thus clears the concept of reading files when file size is large.

2) shows the use of funtion gcount() whose implementation is missing in most of the tutorials.

3) the user can alter the value of variable "num_of_bytes", thus a value larger than the size of the file can also be used for experimenting purposes.

4) highly commented code, thus clarifies everything in the code.


Info:

the name "umg.rar" is the name of input file, it should be changed to the user specific filename, also the path for sorce file and destination files should also be changed as per requirement.

Lastly:

This is my first code which i am publishing online, just because i thought there are almost no code available online to demonstrate file copy in binary taking a loop. (if there are, then i am sorry).
I hope you like the code.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Pawan84



India India

Member

My name is Pawan Pillai.
I am an Information Technology Engineer from India.
I like programming in C, C++ and Java.
My interests are watching movies, playing cricket and table tennis and surfing internet for almost anything.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralWorks Perfect Pinmemberrajmajama15:56 24 May '11  
GeneralThanks PinmemberIdent817:59 27 Jan '10  
GeneralMy vote of 1 PinmemberBartosz Wojcik13:08 5 Dec '09  
GeneralMy vote of 1 PinmemberTsuda Kageyu3:46 2 Dec '09  
GeneralBinary Copy Code PinmemberC++_Rabbit16:53 27 Jun '08  
GeneralJust what I was looking for PinmemberRob.Kinney8:15 14 Jun '07  
QuestionHow to use ifstream & ofstream with unicode (16 bit wchar_t) file name? PinmemberTongle The Great2:25 6 Feb '07  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 5 Feb 2007
Article Copyright 2007 by Pawan84
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid