You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find it funny that the example of fread in the provided reference is basically identical to what get_name does, and they store the return value as bytes_read even though that would only be the case if the size and nmemb values were reveresed.
EXAMPLES
Reading from a Stream
The following example reads a single element from the fp stream into the array pointed to by buf.
#include <stdio.h>
...
size_t bytes_read;
char buf[100];
FILE *fp;
...
bytes_read = fread(buf, sizeof(buf), 1, fp);
...
The fread() as used here does a partial read of a single element for any stream that yields less than 64 bytes, and the value of a partial element is unspecified according to https://pubs.opengroup.org/onlinepubs/009695399/functions/fread.html
The text was updated successfully, but these errors were encountered: