so i have a win32 program that is supposed to make a rotating cube and put a picture that i specify on the faces of the cube. the picture is in pnm (ppm) format. the program worked great in linux. problem is in windows it will compile but not run! the error i get is
“DEBUG assertion failed!”
program: e:\cube\debug\cube.exe
file: fscanf.c
line: 54
Expression: stream != null
i don’t know what to do. can’t find an answer. here’s the code from the main function…
int main(int argc, char **argv) {
FILE *fd;
int k, nm;
char c;
int i;
char b[70];
float s;
int red, green, blue;
printf(“enter file name: “);
scanf(”%s”, b);
fd = fopen(“bill.pnm”, “r”);
fscanf(fd, “%[^
]”, b);
if (b[0] != ‘P’| | b[1] != ‘3’) {
printf("%s is not a PPM file!
", b);
exit(0);
}
fscanf(fd, “%c”, &c);
fscanf(fd, “%c”, &c);
fscanf(fd, “%c”, &c);
fscanf(fd, “%c”, &c);
fscanf(fd, “%c”, &c);
fscanf(fd, “%c”, &c);
while (c == ‘#’) {
fscanf(fd, “%[^
]”, b);
fscanf(fd, “%c”, &c);
}
ungetc(c, fd);
fscanf(fd, “%d %d %d”, &n, &m, &k);
printf("%d rows %d columns max value = %d
", n, m, k);
nm = n*m;
image = malloc(3*sizeof(GLuint)*nm);
s = 255./k;
for(i = 0; i <nm; i++) {
fscanf(fd, “%d %d %d”, &red, &green, &blue);
image[3nm - 3i - 3] = red;
image[3nm - 3i - 2] = green;
image[3nm - 3i - 1] = blue;
}
glPixelTransferf(GL_RED_SCALE, s);
glPixelTransferf(GL_GREEN_SCALE, s);
glPixelTransferf(GL_BLUE_SCALE, s);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(n, m);
glutInitWindowPosition(0, 0);
glutCreateWindow(“image”);
glutReshapeFunc(myreshape);
glutDisplayFunc(display);
glutIdleFunc(spincube);
init();
glutMainLoop();
}
if you need more let me know!
-dave