Thread: binary file again

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    63
    Hi Adak,

    your program does not seem to do what i want it just copy the file and display his size!.

    Regards.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by jean.yves View Post
    Hi Adak,

    your program does not seem to do what i want it just copy the file and display his size!.

    Regards.
    The key thing is that it takes a file, gets the size of the file, and makes the buffer exactly that size. Then it puts everything from the file, into the buffer so you can then do whatever you want to do with it.

    If you don't want to see the file size displayed, just // it out.

    Remember to open the output of the hex dump file though, NOT the original data file.

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    63
    Ok but the main problem is how to bufferize(store in a buffer) the data of the file as a string (hex dump) so i can manipulate them more simply.

    Example:
    suppose the hex dump of my binary file is :

    Code:
    0000000      ff07    ffff    ffff    ffff    ffff    ffff    ffff    ffff
    0000020      06ff    1016    0740    fff3    ffff    ffff    ffff    ffff
    0000040      6004    0101    3074    ffff    ffff    ffff    4bff    4200
    0000060      331f    0000    0051    fff1    ffff    4bff    4200    011f
    0000100      ff04    00ff    0011    0000    ff00    1610    1939    1202
    i want to store it in a char buffer:

    char buffer[512];

    and after running the program i can loop through my data file using this char buffer.

    Regards.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can you help me about tolower() in file
    By nctar in forum C Programming
    Replies: 7
    Last Post: 05-12-2010, 10:04 AM
  2. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  3. Print file in binary mode
    By vikernes in forum C++ Programming
    Replies: 6
    Last Post: 02-25-2006, 12:43 AM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  5. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM