diff options
Diffstat (limited to 'man3/fread.3')
-rw-r--r-- | man3/fread.3 | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/man3/fread.3 b/man3/fread.3 index fbfd4f60f..2874d4332 100644 --- a/man3/fread.3 +++ b/man3/fread.3 @@ -16,7 +16,7 @@ .\" Modified Thu Apr 20 20:43:53 1995 by Jim Van Zandt <jrv@vanzandt.mv.com> .\" Modified Fri May 17 10:21:51 1996 by Martin Schulze <joey@infodrom.north.de> .\" -.TH fread 3 2022-12-29 "Linux man-pages 6.03" +.TH fread 3 2023-07-20 "Linux man-pages 6.05.01" .SH NAME fread, fwrite \- binary stream input/output .SH LIBRARY @@ -82,23 +82,23 @@ to determine which occurred. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). -.ad l -.nh .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ +.na +.nh .BR fread (), .BR fwrite () T} Thread safety MT-Safe .TE -.hy -.ad .sp 1 .SH STANDARDS -POSIX.1-2001, POSIX.1-2008, C99. +C11, POSIX.1-2008. +.SH HISTORY +POSIX.1-2001, C89. .SH EXAMPLES The program below demonstrates the use of .BR fread () @@ -118,41 +118,41 @@ Class: 0x02 .EX #include <stdio.h> #include <stdlib.h> - +\& #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) - +\& int main(void) { FILE *fp; size_t ret; unsigned char buffer[4]; - +\& fp = fopen("/bin/sh", "rb"); if (!fp) { perror("fopen"); return EXIT_FAILURE; } - +\& ret = fread(buffer, sizeof(*buffer), ARRAY_SIZE(buffer), fp); if (ret != ARRAY_SIZE(buffer)) { fprintf(stderr, "fread() failed: %zu\en", ret); exit(EXIT_FAILURE); } - +\& printf("ELF magic: %#04x%02x%02x%02x\en", buffer[0], buffer[1], buffer[2], buffer[3]); - +\& ret = fread(buffer, 1, 1, fp); if (ret != 1) { fprintf(stderr, "fread() failed: %zu\en", ret); exit(EXIT_FAILURE); } - +\& printf("Class: %#04x\en", buffer[0]); - +\& fclose(fp); - +\& exit(EXIT_SUCCESS); } .EE |