size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
The number of elements that were input (nmemb) is returned.
This function inputs nmemb elements of size from the input stream pointed to by stream and stores them in ptr. Only the standard input/output stdin can be specified for stream.
#include <stdio.h> void func(void) { struct { int c; double d; } buf[10]; fread(buf, sizeof(buf[0]), sizeof(buf) / sizeof(buf [0]), stdin); } |