Where is the type FILE in OpenGL?

Started by
2 comments, last by GameDev.net 17 years, 8 months ago
Hi, i have found this piece of OpenGL code below to handle textures but i find an error when compiling at the lines that contains the type FILE. The error is this: 'FILE' undeclared identifier. Where is that type FILE? void *CargaTGA(char *filename,int *tam) { GLubyte TGAheader[12]={0,0,2,0,0,0,0,0,0,0,0,0}; GLubyte TGAcompare[12]; GLubyte header[6]; GLuint bytesPerPixel; GLuint imageSize; GLuint temp,i; GLuint type=GL_RGBA; Imagen texture; GLubyte *aux; FILE *file = fopen(filename, "rb");
Advertisement
It is not an OpenGL type - it is a C standard library type for manipulation of file streams.

If you are having a compile error, you need to include <stdio.h>, or include <cstdio> and change FILE to std::FILE or put "using namespace std;" at the top of your source file.

HTH
ok thanks!

anyway i get the same error trying to declare a TGAHEADER variable:

TGAHEADER tgaHeader;

Where is the TGAHEADER type?
Quote:Original post by tirengarfio
ok thanks!

anyway i get the same error trying to declare a TGAHEADER variable:

TGAHEADER tgaHeader;

Where is the TGAHEADER type?


TGAHEADER is probably created by whoever wrote that code, or some external image library, neither OpenGL , C or C++ has any standard functions, classes or structures dealing with image file formats.

This topic is closed to new replies.

Advertisement