C examples for File:Binary File
Read Number from binary file
#include <stdio.h> int main() {/* w w w . j a v a 2s . c om*/ FILE *intFile; int num; if ((intFile = fopen("num.bin", "wb")) == NULL) { printf("Cannot open file\n"); return -1; } while (scanf("%d", &num) == 1) fwrite(&num, sizeof(int), 1, intFile); fclose (intFile); }