NOTE: I am just trying to collect various answers down in this post available across multiple sites in internet as mentioned in references.
Solution 01:
#include <stdio.h> #include <stdlib.h> int main() { FILE *fp=fopen("temp.dat","w+b"); int number=12346; int divisor=3; char *buf = calloc(number,1); fwrite(buf,number,1,fp); rewind(fp); int result=fread(buf,divisor,number,fp); printf("%d / %d = %d", number, divisor, result); free(buf); fclose(fp); return 0; }