[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to read and write a 24-bit bitmap file

Posted on 2004-04-23
3
Medium Priority
?
329 Views
Last Modified: 2008-02-01
I need to read and write a bitmap file and am unsure on how to begin this...

I have the way i want the read and write functions to work but am not sure as to what header information and such i need to pass to get this to work.
Here is the read function that i need to code:

/*Read Bitmap File function
  Function: readBMPFile(outfile, bmpHeaderRef)
  Purpose:      gets the bitmap from the infile
  Params:      infile - bitmap file of image
                  bmpHeaderRef - a reference to the memory buffer
                  for the header information
  Return:      reference to a memory buffer containing the bitmap
                  data, NULL if unsuccessful reading the image file
  Algorithm:
*/
BYTE * readBMPFile(FILE *inFile,BMPHEADER *bmpHdrPtr)
{
      //Insert code
}


and here is the Write bitmap code that i need to work with
/*write Bitmap to File function
  Function: writeBMPFile(outfile, bmpHeaderRef, bmpDataRef)
  Purpose:      writes the bitmap in memory to the outfile
  Params:      outfile - bitmap file of write image to
                  bmpHeaderRef - a reference to the memory buffer
                  for the header information
                  bmpDataRef - a reference to the memory buffer with
                  the bitmap image data
  Return:      boolean indicating success or failure of write
  Algorithm:
*/
int writeBMPFile(FILE *inFile,BMPHEADER *bmpHdrPtr, BYTE* bmpDataRef)
{
      //Insert code
}


Hopefully someone has a simple solution and could explain there code well enough because i'm a beginner c programmer.

Thanks in Advance.
0
Comment
Question by:Adam409
2 Comments
 
LVL 1

Expert Comment

by:MegaEnforcerBoy
ID: 10901804
Well, for reading BMP files you just need a picture box anywhere;
You need a variable/handler for it; than associate a picture to that picture box :-)
And for storing of bitmaps...it's a very difficult subject...But you are lucky- for some time I have been thinking about the same question; Nobody could tell me anything. But I found an interesting article in MSDN about it. There are 2 functions for saving a bitmap there; thanks to them I've created a graphics editor |- ))))
Here is the adress:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_7zfp.asp
0
 
LVL 9

Accepted Solution

by:
ankuratvb earned 750 total points
ID: 10906146
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question