
June 28th, 2003, 06:24 PM
|
|
Junior Member
|
|
Join Date: Mar 2002
Location: Sweden, LKPG
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Code is segfault:ing
Been awhile since I coded in C and can't seem to find the problem in this small test program. The resault is when running the program a big nice segfault.
PHP Code:
#include <stdio.h>
int main() {
FILE *file;
int *width, *height, *bitsPerPixel;
char *check;
file = fopen("test.bmp", "rb");
fseek(file, 18, SEEK_SET);
fread(width, 4, 1, file);
fread(height, 4, 1, file);
fseek(file, 2, SEEK_CUR);
fread(bitsPerPixel, 4, 1, file);
fseek(file, 22, SEEK_CUR);
fread(check, 1, 1, file);
printf("%ix%ix%i\n", *width, *height, *bitsPerPixel);
printf("Red: %i", *check);
fclose(file);
return 0;
}
What am I doing wrong ?
|