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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading files into binary 1

Status
Not open for further replies.

rubenr20

Programmer
Jun 10, 2007
1
US
Hello,
I am new to this forum and to programming. My first small project in C is to write a little program to read a file (text, video, sound, pic) and dump its raw binary content and perhaps convert it into hex.
How can I do this in open watcom? or do you have code in other C compiler. thxs
 
Use fopen() using "rb" as the mode.
Use fgetc() or fread() to read either a single byte or an array of bytes, and format to how you want.
Use fclose() when you're done.


--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top