Question: how can I put the file.bmp to array using standard lib c++ or c whithout windows.h ect

edit
I want to get bmp colors to array change the array and put to bmp using standard lib

Answer: 
Use a binary stream:

```
#include <fstream>

char buffer[100];
ifstream myFile ("myImage.bmp", ios::in | ios::binary);
myFile.read (buffer, 100);

myFile.close();

```

However, parsing it will be a bit trickier if you insist on doing it that way. I suggest you look into a generic C++ image library, such as the [boost GIL](http://www.boost.org/doc/libs/1_39_0/libs/gil/doc/) (doesn't support bmp) or [this open source bmp library](http://easybmp.sourceforge.net/).

If you are unable to use any third party or OS-specific libraries, you will have to parse the data yourself. The C++ standard libraries don't include anything to do that for you. You'll have to start by familiarising yourself with the BMP structure. [Wikipedia's article](http://en.wikipedia.org/wiki/BMP_file_format) has a good description of it.
```
File f = new File(fileName);
//get the file length
//create a buffer big enough.
file.read(buffer, size)...

```

Of course you might not really want the bitmap file in an array, because the array would contain all the bitmap header info, not just the color map. 

Now if this is homework (and I'm betting it is), then you could create a new struct that has a header section and a "map" section.. You could suss out how big the header is (i believe there is a variable in the header that tells you how big it is.) With that in hand, you could easily grab only the map data. 

I'd try it out with a CBitmap object, then dig into the code for CBitmap and pull out the bits you need.

sorry for not offering code.. I'm not in C/C++ world these days so it's not as fresh as it once was. 

---

check out the docs on bitblt.. It will help you change your array.. Also a quick google search and you could have found most of this out.
<http://www.vbforums.com/showthread.php?t=261522> was the first hit I got on bitmap
[How to change, modify, cut and swap pixels from BITMAP](https://stackoverflow.com/questions/4899246/how-to-change-modify-cut-and-swap-pixels-from-bitmap) was a bit down the page, but still.. google first, SO last.