c++.dos - Its been a while!
- Paul (24/24) Dec 27 2002 Just getting back into programming, stumped on this
- Al Bowers (7/41) Dec 27 2002 I see messages like this when there is failure to included the appropiat...
- Walter (9/33) Dec 27 2002 There is insufficient information in your post. But typically such can b...
- Paul Warren (5/51) Dec 28 2002 Thanks for your help guys. The below problem was solved
- Gisle Vanem (5/15) Dec 28 2002 Gisle V.
Just getting back into programming, stumped on this error message from some old code I wrote. Function is determing size of memory to allocate. struct runners * runner_alloc(struct runners *runmem_ptr, long *runsize_ptr, FILE *runner_fp) { long file_size; if( (fseek(runner_fp,(long) 0 ,SEEK_END)) != NULL) ****** ERROR LINE ****** { move_error("runners file"); } file_size = ftell(runner_fp)/sizeof(struct runners); rewind(runner_fp); runmem_ptr = (struct runners *) malloc(file_size * sizeof(struct runners)); if( runmem_ptr == NULL) mem_error("runners file"); if( fread(runmem_ptr,sizeof(struct runners),file_size,runner_fp) != file_size) read_error("runners file"); *runsize_ptr = file_size; return runmem_ptr; } ERROR MESSAGE! "Need explicit cast to convert int to *void" Any help appreciated.
Dec 27 2002
Paul wrote:Just getting back into programming, stumped on this error message from some old code I wrote. Function is determing size of memory to allocate. struct runners * runner_alloc(struct runners *runmem_ptr, long *runsize_ptr, FILE *runner_fp) { long file_size; if( (fseek(runner_fp,(long) 0 ,SEEK_END)) != NULL) ****** ERROR LINE ****** { move_error("runners file"); } file_size = ftell(runner_fp)/sizeof(struct runners); rewind(runner_fp); runmem_ptr = (struct runners *) malloc(file_size * sizeof(struct runners)); if( runmem_ptr == NULL) mem_error("runners file"); if( fread(runmem_ptr,sizeof(struct runners),file_size,runner_fp) != file_size) read_error("runners file"); *runsize_ptr = file_size; return runmem_ptr; } ERROR MESSAGE! "Need explicit cast to convert int to *void"I see messages like this when there is failure to included the appropiate header file declaring the function malloc, stdlib.h. -------- Al Bowers mailto: abowers.combase.com
Dec 27 2002
There is insufficient information in your post. But typically such can be caused by calling a function that does not have a declaration for it in scope. -Walter "Paul" <Paul_member pathlink.com> wrote in message news:auj0n3$2cke$1 digitaldaemon.com...Just getting back into programming, stumped on this error message from some old code I wrote. Function is determing size of memory to allocate. struct runners * runner_alloc(struct runners *runmem_ptr, long*runsize_ptr,FILE *runner_fp) { long file_size; if( (fseek(runner_fp,(long) 0 ,SEEK_END)) != NULL) ****** ERROR LINE******{ move_error("runners file"); } file_size = ftell(runner_fp)/sizeof(struct runners); rewind(runner_fp); runmem_ptr = (struct runners *) malloc(file_size * sizeof(structrunners));if( runmem_ptr == NULL) mem_error("runners file"); if( fread(runmem_ptr,sizeof(struct runners),file_size,runner_fp) !=file_size)read_error("runners file"); *runsize_ptr = file_size; return runmem_ptr; } ERROR MESSAGE! "Need explicit cast to convert int to *void" Any help appreciated.
Dec 27 2002
Thanks for your help guys. The below problem was solved by changing the error line to:- if( 0 == fseek(runner_fp,0L,SEEK_END)) as fseek returns an int! Thanks for your help, its appreciated. In article <aujcnn$2lct$1 digitaldaemon.com>, Walter says...There is insufficient information in your post. But typically such can be caused by calling a function that does not have a declaration for it in scope. -Walter "Paul" <Paul_member pathlink.com> wrote in message news:auj0n3$2cke$1 digitaldaemon.com...Just getting back into programming, stumped on this error message from some old code I wrote. Function is determing size of memory to allocate. struct runners * runner_alloc(struct runners *runmem_ptr, long*runsize_ptr,FILE *runner_fp) { long file_size; if( (fseek(runner_fp,(long) 0 ,SEEK_END)) != NULL) ****** ERROR LINE******{ move_error("runners file"); } file_size = ftell(runner_fp)/sizeof(struct runners); rewind(runner_fp); runmem_ptr = (struct runners *) malloc(file_size * sizeof(structrunners));if( runmem_ptr == NULL) mem_error("runners file"); if( fread(runmem_ptr,sizeof(struct runners),file_size,runner_fp) !=file_size)read_error("runners file"); *runsize_ptr = file_size; return runmem_ptr; } ERROR MESSAGE! "Need explicit cast to convert int to *void" Any help appreciated.
Dec 28 2002
"Paul" <Paul_member pathlink.com> wrote:Just getting back into programming, stumped on this error message from some old code I wrote. Function is determing size of memory to allocate. struct runners * runner_alloc(struct runners *runmem_ptr, long *runsize_ptr, FILE *runner_fp) { long file_size; if( (fseek(runner_fp,(long) 0 ,SEEK_END)) != NULL) ****** ERROR LINE ******fseek() returns an int, not a pointer.ERROR MESSAGE! "Need explicit cast to convert int to *void"Gisle V. /bin/laden: Not found
Dec 28 2002