Results 1 to 5 of 5

Thread: parsing string

  1. #1

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919

    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
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Is it binary data stored sequentially in a buffer? If it is, you can use the shifting << >> and masking & | ^ operators.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    huh?

    lol

    im reading it in from a file. i read in like the first 256 bytes approx
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  4. #4
    Fanatic Member twanvl's Avatar
    Join Date
    Dec 2001
    Posts
    771
    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.

  5. #5

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    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
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width