Posted By:
4 Jul, 2013 1:35 pm PDT

Reading and writing of binary files in C++

How to read and write data in a binary file

File streams include two special member functions to read and write in binary files: "read" and "write". The format for read and write 

write (memory_block, size);
read (memory_block, size);

Where memory_block is of type "pointer to char" (char*), and represents the address of an array of bytes where the read data elements are stored or from where the data elements to be written are taken.

The size parameter is an integer value that specifies the number of characters to be read or written from/to the memory block.

Was it useful?  

Please login to reply to this problem.