Thread: Content miss match

  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    8

    Content miss match

    I am using c to read and write contents of a file into other:

    FILE *ptr;
    status_t status;
    uint32_t block_size, result;
    uint32_t num_blocks;
    char temp_buffer[1024];

    ptr = fopen("file.RAW", "r+");
    fseek(ptr, 0, SEEK_SET);

    if (ptr == NULL)
    return -1 ;
    block_size = 1024;
    // allocate memory to contain the whole file:
    // temp_buffer = (char*) malloc (sizeof(char)*block_size);



    num_blocks = sizeof(char);

    result = fread(&temp_buffer, num_blocks, block_size, ptr);

    ptr = fopen("file3.txt", "w+");

    fseek(ptr, 0, SEEK_SET);

    if (ptr == NULL)
    return -1;

    block_size = sizeof(temp_buffer);
    num_blocks = sizeof(char);
    fwrite(&temp_buffer, num_blocks, block_size, ptr);
    status = fclose(ptr);

    But when i open file3.txt i see these symbols:
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿù`‘~ +Pg]Nñòs

    Is there way to see the binary content of this file.

    PS: i also tried same in python but no success

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Is there way to see the binary content of this file.
    You'll need some sort of hex editor/viewer to view your binary file.

    Jim

  3. #3
    Registered User
    Join Date
    Jun 2012
    Posts
    14

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Does bsearch ever miss?
    By MAtkins in forum C Programming
    Replies: 4
    Last Post: 02-17-2011, 09:10 AM
  2. What did I miss about boosts sparse matrix library?
    By pheres in forum C++ Programming
    Replies: 4
    Last Post: 04-13-2008, 08:09 AM
  3. else is Miss Placeed????????
    By RahulDhanpat in forum C Programming
    Replies: 10
    Last Post: 02-12-2008, 04:41 AM
  4. cache miss/hit
    By xddxogm3 in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2007, 06:51 PM
  5. I miss C
    By silk.odyssey in forum C++ Programming
    Replies: 5
    Last Post: 05-03-2004, 06:00 PM

Tags for this Thread