Read several bytes, jump over N bytes, and then read several bytes again.
how?
I have a binary file, a.bin, which contains 768 bytes.
And I want put the bytes 16-256, 272-512, 528-768 into
char data[720]
I did somethin like
ifstream a1;
a1.open("a.bin", ios::in|ios::binary)
char tmp[256]
a1.read(tmp,256)
And then I did some loop and copy tmp to data[720] in logic. But that
looks really stupid. So I want to ask
How can I read data to certain position of a char arry ?
a1.read(tmp[2],2) // not allowed, how to achieve this?
How can I jump over certain day?
a1.read(tmp16,16); I can use this to jump 16 bytes and neve use tmp16, but
it looks ugly.
No comments:
Post a Comment