I am trying to write a code that read a size of file then allocate the buffer size accordingly.
for some reason my buffer size is not changing its 4 Bytes always.
Any tips why my buffer is not allocating memory equal to the read file size?
#include <stdio.h>
#include <stdlib.h>
int main ()
{
FILE *file,*fp;
file = fopen("file.txt", "r");
fp = fopen( "outputnew.txt" , "w" );
long lSize;
fseek(file, 0, SEEK_END);
lSize = ftell(file);
fseek(file, 0, SEEK_SET);
char *buffer = (char*) malloc(sizeof(char)*lSize);
printf("%d\n",sizeof(buffer));
return(0);
}