I have a binary file that I am trying to determine the size of and I produced the following code to do so...
1 2 3 4 5 6 7 8
FILE *file = fopen("binaryBuffer.txt", "r");
if(file == NULL) return;
unsignedlonglongint length = 0;
int n = 0;
while(n != EOF){
n = fgetc(file);
length++;
}
The file is not formatted in any way, it is just random and raw data.
I tested the code and it seemed to work however I tested it on quite a few files and I had a file that was 65536 bytes long and this code only detected a length of about 4100.