I have one question regarding the design of my application. Here's the pseudo code:
char* buffer_to_be_filled = (char*) malloc(somesize); fill_the_buffer(buffer_to_be_filled); free(buffer_to_be_filled);
The problem is that I do not know how much fill_the_buffer size is fill_the_buffer .
I was thinking of a solution inside the fill_the_buffer function. I could perhaps redistribute the space inside when necessary; The problem is, is there a way to find out how much space I have available?
How is this usually solved? I think that the one who allocates the buffer should also redistribute the buffer, right?
NOTE. I fill the buffer with the fread function, so I donβt know how much space I need.
source share