-
parsing string
ive got this info:
Byte# Data Details
===================================================================
1-4 Sequence header In Hex 000001B3
code
12 bits Horizontal size In pixels
12 bits Vertical size In pixels
ive been trying to figure out how to parse it, its for an MPEG file, can someone help me out?
thanks :)
-
Is it binary data stored sequentially in a buffer? If it is, you can use the shifting << >> and masking & | ^ operators.
-
huh?
lol
im reading it in from a file. i read in like the first 256 bytes approx
-
I asume that you want the numbers?
You can try to find them by searching for text around it, if your data is in a string, then:
int pos = file.find("Sequence header In Hex ")+23//23=length of string
istringstream hex_str(file.substr(pos,8));
int hex_data;
hex_str >> setbase(16) >> hex_data;
And so on for each field you want to know.
-
well according to the format, itll be here:
Code:
00 00 01 B3 16 00 F0 C4 02 A3 20 A5 10 12 12 14
14 14 16 16 16 16 18 18 19 18 18 1A 1B 1B 1B 1B
1A 1C 1D 1E 1E 1E 1D 1C 1E 1F 20 21 21 20 1F 1E
21 23 23 24 23 23 21 25 26 27 27 26 25 29 2A 2A
2A 29 2D 2D 2D 2D 30 31 30 34 34 38 16 00 F0 C4
00 00 01 B8 00 08 00 00 00 00 01 00 00 0A 72 00