Lines Matching refs:fp
36 void skip_bytes (FILE *fp, int n) in skip_bytes() argument
39 fgetc (fp); in skip_bytes()
43 int error (char * msg, FILE *fp) in error() argument
47 fclose (fp); in error()
76 FILE *fp; in main() local
95 fp = fopen(argv[2], "rb"); in main()
96 if (!fp) { in main()
101 if (fgetc (fp) != 'B' || fgetc (fp) != 'M') in main()
102 error ("Input file is not a bitmap", fp); in main()
108 skip_bytes (fp, 8); in main()
109 if (fread (&data_offset, sizeof (uint16_t), 1, fp) != 1) in main()
110 error ("Couldn't read bitmap data offset", fp); in main()
111 skip_bytes (fp, 6); in main()
112 if (fread (&b->width, sizeof (uint16_t), 1, fp) != 1) in main()
113 error ("Couldn't read bitmap width", fp); in main()
114 skip_bytes (fp, 2); in main()
115 if (fread (&b->height, sizeof (uint16_t), 1, fp) != 1) in main()
116 error ("Couldn't read bitmap height", fp); in main()
117 skip_bytes (fp, 22); in main()
118 if (fread (&n_colors, sizeof (uint16_t), 1, fp) != 1) in main()
119 error ("Couldn't read bitmap colors", fp); in main()
120 skip_bytes (fp, 6); in main()
152 error ("Error allocating memory for file", fp); in main()
158 b->palette[(int)(i*3+2)] = fgetc(fp); in main()
159 b->palette[(int)(i*3+1)] = fgetc(fp); in main()
160 b->palette[(int)(i*3+0)] = fgetc(fp); in main()
161 x=fgetc(fp); in main()
173 fseek(fp, (long)data_offset, SEEK_SET); in main()
182 b->data[i + x] = (uint8_t) fgetc(fp) in main()
201 fclose(fp); in main()