Hello,

when I give fprintf the character 0x0A, then it prints out 0x0D and 0x0A (which is \n in Windows). How can I print only 0x0A? I need to print a picture into a file containing 16-bit pixels, (and some bytes contain the value of 0x0A,) so it is very bad if I cannot do it because of this bug.

fprintf(file, "%c", 10);

Greetings,
Dani

Recommended Answers

All 2 Replies

Open the file in binary mode and use binary output functions, not fprintf()

Open the file in binary mode and use binary output functions, not fprintf()

Thanks for the advice, this helped.

Greetings: Dani

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.