saving output to bmp file

B

bauran

Thank you for replying.
But can you please tell me step by step.
when we write fwrite(bmp, 54, 1, fp), bmp format is written into file.
Now by fseek, we moved to 54th byte of file.
Upto here it is ok.
But what is the meaning of for ex:
fputc(0x0,fp), fputc(127,fp), fputc(255,fp) etc. and that too 4*16
times.

Please explain.
 
B

bartc

bauran said:
I needed to save turbo c graphics program output in a bmp file
So on googling, I got the following code http://pastebin.com/f5af4c528
But here I can't understand that 64 times fputc and left shfting.
please explain that.

BMP format is 54 bytes of header, followed by an optional colour palette
(for 16-colour, 256-colour, and possibly 2-colour images, 4 bytes per
colour), followed by the image data.

Those 64 bytes suggest this is a 16-colour 4-bits/pixel file.

Was there supposed to be a question 2 in there about left-shifting?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top