Where is the type FILE?

Hi,

i have found this piece of 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”);

FILE (and the related functions) are part of the C standard library and are defined in stdio.h.

ok thanks!

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

TGAHEADER tgaHeader;

Where is the TGAHEADER type?

grep -r TGAHEADER *

:wink:

TGAHEADER is not in a standard C library but normally defined by the programmer writing the TGA image load routine.
Look in the headers belonging to the “piece of code you found”.

Other than that, there is a website dedicated to list file formats http://www.wotsit.org/
Read that and write your own TGA header struct if you like.

That looks like your using code from the tga tutorial on NeHe.

http://nehe.gamedev.net

Yea, that’s the one used on nehe.
The tga loader we at nehe currently have in development is a lot slimmer than that chunky code (and a lot better to).

Originally posted by ZbuffeR:
grep -r TGAHEADER *
hmmm…

find / -name “*” -exec grep -n -H TGAHEADER {} ;

Originally posted by RigidBody:
[b] [quote]Originally posted by ZbuffeR:
grep -r TGAHEADER *
hmmm…

find / -name “*” -exec grep -n -H TGAHEADER {} ; [/b][/QUOTE]grep -r -n TGAHEADER /
with ‘grep (GNU grep) 2.5.1’

Originally posted by ZbuffeR:
[b] [quote]Originally posted by RigidBody:
[b] [quote]Originally posted by ZbuffeR:
grep -r TGAHEADER *
hmmm…

find / -name “*” -exec grep -n -H TGAHEADER {} ; [/b][/QUOTE]grep -r -n TGAHEADER /
with ‘grep (GNU grep) 2.5.1’ [/b][/QUOTE]hehehe…ok :stuck_out_tongue:

but if i want to check only header files?

find / -name “*.h” -exec grep -n -H TGAHEADER {} ;

geeks :slight_smile:

yeah- but feelin’ good with it :smiley:

thx for the -exec trick btw, I just needed that today :wink:

you’re welcome.

now all we need is someone who says that he could never remember the syntax and that it can be done much easier with the windows explorer :stuck_out_tongue: