What is the size of a char pointer?
What is the maximum size of a pointer to a char?
I went to allocate a char pointer using malloc to the size of 49,152 bytes, but for some reason, when I looked at a memory dump, it only allocated ~1300 bytes in memory.
Heres my code: (buffer is the pointer that is only allocated this meager amount of ~1300 bytes. I'm opening a file thats 49Kb and for some reason my compiler wont give it that amount of memory to work with. Is this some limitation of C?)
Code:
char * store(char filename[])
{
char * buffer;
long fileSize = 0;
image = fopen(filename,"r");
// Obtain the file size
fseek(image, 0, SEEK_END);
fileSize = ftell(image);
rewind(image);
buffer = malloc(sizeof(char) * fileSize);
fread(buffer,1,fileSize,image);
fclose(image);
buffer = strToHexStr(buffer);
return formatOuput(buffer);
}