A simple way to copy raw bytes in files in C++

Programming, for all ages and all languages.
Post Reply
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

A simple way to copy raw bytes in files in C++

Post by earlz »

Ok, I am fairly new to iostreams, and this is just starting to get annoying...
I can't figure out how the crap to just copy one byte out of the file and into an array..

I can't figure out a way to get the total file size of the stream, or to read a single character *easily*

I mean, their is the get(), but that does formatting, and can be complicated with raw binary files, I don't need formatting, I just need the raw bytes!
User avatar
bluecode
Member
Member
Posts: 202
Joined: Wed Nov 17, 2004 12:00 am
Location: Germany
Contact:

Re: A simple way to copy raw bytes in files in C++

Post by bluecode »

hckr83 wrote:I can't figure out a way to get the total file size of the stream [...]
Seek to the end with seekg and then get the get pointer position with tellg.
I mean, their is the get(), but that does formatting.
It does not, see here. There is also a read function.
Post Reply