codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#define WIDTH 640 #define HEIGHT 480 #include<stdio.h> #include<stdlib.h> typedef struct color{ unsigned char r; unsigned char g; unsigned char b; }COLOR; int main(){ int i, j; COLOR data[WIDTH][HEIGHT]; FILE *fp; if((fp = fopen("image.bmp", "rb")) == NULL){ fprintf(stderr, "file open error"); exit(1); } fseek(fp, 54, SEEK_SET); for(j=HEIGHT-1; j>=0; j--){ for(i=0; i<WIDTH; i++){ data[i][j].b = getc(fp); data[i][j].g = getc(fp); data[i][j].r = getc(fp); } } fclose(fp); return 0; }
Private
[
?
]
Run code
Submit