Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write an int & a hex to a file?

Status
Not open for further replies.

TheButcher

Programmer
Jul 6, 2001
11
US
Can someone pleez help me out here.

For the int:
I tried using fputs(), but this gave me a warning and then a core dump. Then I tried it using fputc() but it gave me '^F' character????????. These are the only 2 functions in my book for file writing. Can I cast it? If so, how.

For the hexadecimal:
I have the number as an int and want to write it to the file as a hex. I can print it onto the screen as a hex by using the %x in the printf() function. Is there a way to fully convert it into a hex number so I can write it to a file. I can't find a function that does this in my C book.

Thanks in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top