Jump to content

View more

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

I need some help

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
4 replies to this topic

#1 loloh   Members   

122
Like
Likes
Like

Posted 16 October 2001 - 07:03 AM

I have that : ... GLuint LoadTexture( const char * filename, int wrap ) { int width, height; BYTE * data; FILE * file; file = fopen( filename, "rb" ); if ( file == NULL ) return 0; width = 256; height = 256; data = malloc( width * height * 3 ); //error with data fread( data, width * height * 3, 1, file ); fclose( file ); .... } ... and I have an error that I really don''t understand : cannot convert from ''void *'' to ''unsigned char *'' can you describe me why this is wrong ?

#2 MENTAL   Members   

383
Like
Likes
Like

Posted 16 October 2001 - 07:08 AM

fread((void*) data, width * height * 3, 1, file );

should do it. if not, then do

fread((void) data, width * height * 3, 1, file );

bascially, "void *" means it just wants a memory address, and it couldnt care less what type of memory it points to, so yeah, just shove (void*) or (void) infront of "data" and it will work.


MEBTAL

#3 loloh   Members   

122
Like
Likes
Like

Posted 16 October 2001 - 10:53 AM

thanks for your help
but the error is from this line :
data = malloc( width * height * 3 );

I tried your suggestion but that don''t work

#4 Null and Void   Members   

1087
Like
Likes
Like

Posted 16 October 2001 - 11:06 AM

  
data = (BYTE *) malloc(width * height * 3);

Try to stay away from using the Win32 typedefs (like BYTE) in code that doesn''t have anything to do with the Win32 API. I guess it is just a pet peeve of mine.

[Resist Windows XP''s Invasive Production Activation Technology!]

#5 loloh   Members   

122
Like
Likes
Like

Posted 16 October 2001 - 11:48 AM

that''s working !!

thanks a lot :o)






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.