User Profile

Collapse

Profile Sidebar

Collapse
kenone
kenone
Last Activity: Aug 12 '08, 07:55 AM
Joined: Jul 25 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • kenone
    replied to Bit-by-bit Reading from Memory
    in C
    I read in a binary file which is about 1/2 Gb to a char array. I then have to search for the first occurrance of 10101 or 111, that is the header of a message, what follows is the data of different size fields. I have found it too difficult, and cumbersome, to search for the pattern (using file.get())and then extract the fields as the pattern can start in any bit in a byte (for instance the lsb could be the start of the pattern 10101 but for the...
    See more | Go to post

    Leave a comment:


  • kenone
    started a topic Bit-by-bit Reading from Memory
    in C

    Bit-by-bit Reading from Memory

    How do you read a binary file in memory bit-by-bit?

    ifstream file ("my.bin", ios::in|ios::bi nary|ios::ate);
    if (file.is_open() )
    {
    size = file.tellg();
    memblock = new char [size];
    file.seekg (0, ios::beg);
    file.read (memblock, size);


    I was using file.get() but returns the next char I really want the next bit.

    Any help is appreciated. :-)
    See more | Go to post

  • kenone
    started a topic Pattern Search in Binary FIle
    in C

    Pattern Search in Binary FIle

    I have loaded a large binary file into memory and now I want to search for 10101. I was using file.get to return the next hex number and see if it was equal to 0x15. This is not correct as part of my seach pattern (10101) may straggle over two hex numbers.

    Does anyone know of a way to find the pattern 10101 in a binary file loaded into memory?

    Any help is appreciated.
    See more | Go to post
    Last edited by kenone; Jul 25 '08, 12:43 PM. Reason: Missed out the word file
No activity results to display
Show More
Working...