Suppose we want to blur an image, and the first step is to read the image, what is the purpose of using file.read(reinterpret_cast(&variableName), sizeof(variablename)) ?
struct BitmapInfo {
short signature;
int fileSize;
int reserved;
int offsetToBits;
int headerSize;
int width;
int height;
} __attribute__((packed));
int main() {
fstream file("BLUE SHARD.bmp");
auto bmpInfo = BitmapInfo();
file.read(reinterpret_cast<char*>(&bmpInfo), sizeof(bmpInfo));
auto additionalData = vector<char>(bmpInfo.offsetToBits - sizeof(bmpInfo));
file.read(reinterpret_cast<char*>(&additionalData[0]), bmpInfo.offsetToBits - sizeof(bmpInfo));
auto pixels = vector<vector<rgba>>(bmpInfo.height);
for (int i=0; i<bmpInfo.height; i=i+1) {
pixels[i] = std::vector<rgba>(bmpInfo.width);
file.read(reinterpret_cast<char*>(&pixels[i][0]), bmpInfo.width * sizeof(rgba));