/**
*2014/9/24 02:23
*讀取bmp資訊.cpp
*author:王炳華
*執行此檔案,在同目錄下存放乙個名為dog.bmp的,格式必須為bmp
*/#include#include#define bmptype 19778
bool isbmp(file *f);
int multiply_2(int i);
void headerpartlenght(file *f);
void widthheight(file *f);
void fileheader(file* f);
void infoheader(file* f);
void datapart(file *f);
void colordata(file *f);
void datadata(file *f);
short bibitcount = 0;
int clrtable = 0;//需要多少個顏色表項
long width = 0;
long height = 0;
int main()
else
else
}return 0;
}int multiply_2(int i)
return result;
}bool isbmp(file *f)
void headerpartlenght(file *f)
void widthheight(file *f)
void fileheader(file* f)
void infoheader(file* f)
void colordata(file *f)
}void datapart(file *f)
//將乙個畫素點寫入到檔案中
file *w = fopen("1.txt","w+");
for(m = 0;m < byteheight;m++)
}} printf("*************************************\n");
printf("**************data area**************\n");
printf("*************************************\n");
printf("the data is written into the file successfully!\n");
free(count);
free(ch);
fclose(f);
fclose(w);
}
c語言讀取bmp檔案
一 了解bmp檔案的格式 位 件頭 位圖資訊段 調色盤資訊 一般都沒有 位圖資料,各部分關鍵字段。詳細資訊參見 讀取bmp檔案的函式所需要的標頭檔案 include include include include include bmpstru.h define malloc type,n type...
c語言讀取bmp檔案完整版
include include 定義word為兩個位元組的型別 typedef unsigned short word 定義dword為四個位元組的型別 typedef unsigned long dword 位 件頭主要是對位 件的一些描述 位圖資訊頭主要是對位圖影象方面資訊的描述 位圖標準資訊 ...
c語言建立寫入和讀取TXT檔案資料
下面是乙個簡單檔案讀取程式,首先是寫資料,將數字0 9寫入到data.txt檔案中,然後再從data.txt中讀取資料,將讀到的資料存到陣列a 10 中,並且列印到控制台上。下面是程式 cpp view plain copy print?include int main for int i 0 i ...