if ((stream = fopen("D:\\DUMMY.FIL", "rb"))
== NULL)
{
fprintf(stderr,
"Cannot open output file.\n");
return 1;
}
/* read the data and display it */
fread(buf, 100, 1, stream);
printf("%s\n", buf);
The function fread() reads num number of objects (where each object is size bytes) and places them into the array pointed to by buffer. The data comes from the given input stream. The return value of the function is the number of things read.