Question
How to load a bmp file into an array of integers in C Basically I have created a bmp file (shown below) and am being
How to load a bmp file into an array of integers in C
Basically I have created a bmp file (shown below) and am being asked to load said file using a loadFile function. I just am not sure how I would use fopen() and fread() commands to load the bmp info into an array of integers.
BMP file:
42 4D F6 04 00 00 00 00 00 00 76 00 00 00 28 00
00 00 03 00 00 00 04 00 00 00 01 00 04 00 00 00
00 00 80 04 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 FF FF 00 00 00 FF FF 00
00 00 00 FF 00 00 00 FF FF FF FF 00 00 00 FF 00
00 00 FF FF 00 00 FF 00 00 00 00 00 FF 00 FF 00
FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00
2.1. Include required libraries and define required variables and define a 2D array to store the data loaded from the file.
2.2. Write a function loadFile(myBmp) to read a .bmp file and store them into an 2D array of integers.
First part of the question included just so that you understand what was asked for the set up of the code.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started