1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
int * c_pix
....
c_pix = (int*)malloc(sizeof(int));
if(c_pix == NULL) {
fprintf(stderr,"Out of memory\n");
return 1;
}
fread(c_pix, 4, 1, fileIn);
/* allocation de la structure de données */
pix = (struct pixel*)malloc(sizeof(struct pixel));
if(pix == NULL) {
fprintf(stderr,"Out of memory\n");
return 1;
}
pix->red = redFromRGB(c_pix);
pix->green = greenFromRGB(c_pix);
pix->blue = blueFromRGB(c_pix);
printf("*c_pix=<%08x>\n",*c_pix);
printf("red=<%d>\n",pix->red);
printf("green=<%d>\n",pix->green);
printf("blue=<%d>\n",pix->blue); |