Help with memory allocation functions

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help with memory allocation functions

926 Views
MQXuser
Contributor III

FILE_PTR   fpr;
fpr = _mem_alloc_zero(4096);
fpr = fopen("c:\\LIMBIC.S19", "r");
fclose(fpr);

 

what does fclose do?, does it free the mem_alloc_zero(4096) ??? 

do I need to call  _mem_free(fpr) ???

do I even need to call _mem_alloc_zero to allocate memory for the file pointer ???

 

Any comments are welcome

0 Kudos
1 Reply

270 Views
eGuy
Contributor IV

 

you don't need to call _mem_alloc_zero.

you don't need to call _mem_free(fpr) either.

 

refer to these files: io_fopen.c and io_fclose.c to understand "fopen" and "fclose"

 

or grab C book, read chapter about io/file etc.