基本的に、4バイトが続く文字列のサイズを指定するバイナリ形式を読んでいます。したがって、バッファから読み取っている4文字を1つの整数にキャストしたいと考えています。
これが私が持っているものです。
int FileReader::getObjectSizeForMarker(int cursor, int eof, char * buffer) {
//skip the marker and read next 4 byes
int cursor = cursor + 4; //skip marker and read 4
char tmpbuffer[4] = {buffer[cursor], buffer[cursor+1], buffer[cursor+2], buffer[cursor+3]};
int32_t objSize = tmpbuffer;
return objSize;
}
考え?