Thread: Trouble reading a hex value, displaying via printf and writing to a file

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    11

    Trouble reading a hex value, displaying via printf and writing to a file

    I'm trying to read a file that has hex values. I fread into a buffer, but I'm have trouble displaying the values via printf. Also, when I try to write the buffer, I'm getting one 0.

    Any suggestions on how to display a hex value and/or write a hex value to a file, would be appreciated.

    Thanks
    MMC

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    A can be displayed in hex notation by

    printf ("%X", value);

    I don't know exactly what you mean by writing a hex value to a file. But perhaps you mean

    fprintf (file, "%X", value);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. IF CONDITION plese help
    By birumut in forum C Programming
    Replies: 12
    Last Post: 03-06-2009, 09:48 PM
  2. Trouble writing to file using fwrite()
    By yougene in forum C Programming
    Replies: 4
    Last Post: 12-30-2008, 05:13 PM
  3. Mutlithreaded file handling
    By nvoigt in forum Windows Programming
    Replies: 11
    Last Post: 06-30-2005, 02:39 PM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM