Skip to content
Advertisement

Woking With BMP File in C++, Ubuntu

I am trying to work with a bmp file in linux with g++ compiler. I am using C++ language.

I Need to load a .bmp file from the standard input. for example:

JavaScript

So I need a Code to do this job. I think storing the whole .bmp file is good by I don’t know how to do this.

I Tried this code but it didn’t Work:

JavaScript

So How should I Do this?

Advertisement

Answer

I Found an answer That Works Correctly. This Code Reads The bmp_info_header from the *.bmp file from the standard input:

JavaScript

the “54” in cin.get() tells the system to accept the max 54 numbers from the input and ignores the other.

now for example if we want to find the *.bmp size we should use this code:

JavaScript
Advertisement