I want to copy a file into a buffer. Here is my code:
FILE *f = fopen(path,"r");
int size = GetFileSize(path);
byte *buffer = new byte[size];
int bytesCopied = 0;
while(bytesCopied != size)
bytesCopied += fread(buffer + bytesCopied,1,size,f);
The file I am testing this on is 4.25KB. The first called to fread reads in 52 bytes. But then it is just stuck in an endless loop where fread returns 0.