PDA

View Full Version : Where is the type FILE?



tirengarfio
07-27-2006, 05:35 AM
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");

memfr0b
07-27-2006, 05:47 AM
FILE (and the related functions) are part of the C standard library and are defined in stdio.h.

tirengarfio
07-27-2006, 06:08 AM
ok thanks!

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

TGAHEADER tgaHeader;

Where is the TGAHEADER type?

ZbuffeR
07-27-2006, 06:41 AM
grep -r TGAHEADER *

Relic
07-27-2006, 06:47 AM
;)

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.

MLeo
07-27-2006, 06:50 AM
That looks like your using code from the tga tutorial on NeHe.

http://nehe.gamedev.net

zeoverlord
07-27-2006, 08:17 AM
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).

RigidBody
07-27-2006, 08:27 AM
Originally posted by ZbuffeR:
grep -r TGAHEADER * hmmm...

find / -name "*" -exec grep -n -H TGAHEADER {} \;

ZbuffeR
07-27-2006, 10:02 AM
Originally posted by RigidBody:

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

find / -name "*" -exec grep -n -H TGAHEADER {} \; grep -r -n TGAHEADER /
with 'grep (GNU grep) 2.5.1'

RigidBody
07-27-2006, 11:52 AM
Originally posted by ZbuffeR:

Originally posted by RigidBody:

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

find / -name "*" -exec grep -n -H TGAHEADER {} \; grep -r -n TGAHEADER /
with 'grep (GNU grep) 2.5.1' hehehe...ok :p

but if i want to check only header files?

find / -name "*.h" -exec grep -n -H TGAHEADER {} \;

knackered
07-28-2006, 06:20 AM
geeks :)

RigidBody
07-28-2006, 08:28 AM
yeah- but feelin' good with it :D

ZbuffeR
07-28-2006, 09:12 AM
thx for the -exec trick btw, I just needed that today ;)

RigidBody
07-28-2006, 09:35 AM
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 :p