Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/stdio.h
$ cat -n /usr/include/stdio.h 1 /* Define ISO C stdio on top of C++ iostreams. 2 Copyright (C) 1991-2024 Free Software Foundation, Inc. 3 Copyright The GNU Toolchain Authors. 4 This file is part of the GNU C Library. 5 6 The GNU C Library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public 8 License as published by the Free Software Foundation; either 9 version 2.1 of the License, or (at your option) any later version. 10 11 The GNU C Library is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public 17 License along with the GNU C Library; if not, see 18
. */ 19 20 /* 21 * ISO C99 Standard: 7.19 Input/output
22 */ 23 24 #ifndef _STDIO_H 25 #define _STDIO_H 1 26 27 #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION 28 #include
29 30 __BEGIN_DECLS 31 32 #define __need_size_t 33 #define __need_NULL 34 #include
35 36 #define __need___va_list 37 #include
38 39 #include
40 #include
41 #include
42 #include
43 #include
44 #include
45 46 #ifdef __USE_MISC 47 # include
48 #endif 49 50 #if defined __USE_XOPEN || defined __USE_XOPEN2K8 51 # ifdef __GNUC__ 52 # ifndef _VA_LIST_DEFINED 53 typedef __gnuc_va_list va_list; 54 # define _VA_LIST_DEFINED 55 # endif 56 # else 57 # include
58 # endif 59 #endif 60 61 #if defined __USE_UNIX98 || defined __USE_XOPEN2K 62 # ifndef __off_t_defined 63 # ifndef __USE_FILE_OFFSET64 64 typedef __off_t off_t; 65 # else 66 typedef __off64_t off_t; 67 # endif 68 # define __off_t_defined 69 # endif 70 # if defined __USE_LARGEFILE64 && !defined __off64_t_defined 71 typedef __off64_t off64_t; 72 # define __off64_t_defined 73 # endif 74 #endif 75 76 #ifdef __USE_XOPEN2K8 77 # ifndef __ssize_t_defined 78 typedef __ssize_t ssize_t; 79 # define __ssize_t_defined 80 # endif 81 #endif 82 83 /* The type of the second argument to `fgetpos' and `fsetpos'. */ 84 #ifndef __USE_FILE_OFFSET64 85 typedef __fpos_t fpos_t; 86 #else 87 typedef __fpos64_t fpos_t; 88 #endif 89 #ifdef __USE_LARGEFILE64 90 typedef __fpos64_t fpos64_t; 91 #endif 92 93 /* The possibilities for the third argument to `setvbuf'. */ 94 #define _IOFBF 0 /* Fully buffered. */ 95 #define _IOLBF 1 /* Line buffered. */ 96 #define _IONBF 2 /* No buffering. */ 97 98 99 /* Default buffer size. */ 100 #define BUFSIZ 8192 101 102 103 /* The value returned by fgetc and similar functions to indicate the 104 end of the file. */ 105 #define EOF (-1) 106 107 108 /* The possibilities for the third argument to `fseek'. 109 These values should not be changed. */ 110 #define SEEK_SET 0 /* Seek from beginning of file. */ 111 #define SEEK_CUR 1 /* Seek from current position. */ 112 #define SEEK_END 2 /* Seek from end of file. */ 113 #ifdef __USE_GNU 114 # define SEEK_DATA 3 /* Seek to next data. */ 115 # define SEEK_HOLE 4 /* Seek to next hole. */ 116 #endif 117 118 119 #if defined __USE_MISC || defined __USE_XOPEN 120 /* Default path prefix for `tempnam' and `tmpnam'. */ 121 # define P_tmpdir "/tmp" 122 #endif 123 124 #define L_tmpnam 20 125 #define TMP_MAX 238328 126 127 /* Get the values: 128 FILENAME_MAX Maximum length of a filename. */ 129 #include
130 131 #ifdef __USE_POSIX 132 # define L_ctermid 9 133 # if !defined __USE_XOPEN2K || defined __USE_GNU 134 # define L_cuserid 9 135 # endif 136 #endif 137 138 #undef FOPEN_MAX 139 #define FOPEN_MAX 16 140 141 142 #if __GLIBC_USE (ISOC2X) 143 /* Maximum length of printf output for a NaN. */ 144 # define _PRINTF_NAN_LEN_MAX 4 145 #endif 146 147 148 /* Standard streams. */ 149 extern FILE *stdin; /* Standard input stream. */ 150 extern FILE *stdout; /* Standard output stream. */ 151 extern FILE *stderr; /* Standard error output stream. */ 152 /* C89/C99 say they're macros. Make them happy. */ 153 #define stdin stdin 154 #define stdout stdout 155 #define stderr stderr 156 157 /* Remove file FILENAME. */ 158 extern int remove (const char *__filename) __THROW; 159 /* Rename file OLD to NEW. */ 160 extern int rename (const char *__old, const char *__new) __THROW; 161 162 #ifdef __USE_ATFILE 163 /* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */ 164 extern int renameat (int __oldfd, const char *__old, int __newfd, 165 const char *__new) __THROW; 166 #endif 167 168 #ifdef __USE_GNU 169 /* Flags for renameat2. */ 170 # define RENAME_NOREPLACE (1 << 0) 171 # define RENAME_EXCHANGE (1 << 1) 172 # define RENAME_WHITEOUT (1 << 2) 173 174 /* Rename file OLD relative to OLDFD to NEW relative to NEWFD, with 175 additional flags. */ 176 extern int renameat2 (int __oldfd, const char *__old, int __newfd, 177 const char *__new, unsigned int __flags) __THROW; 178 #endif 179 180 /* Close STREAM. 181 182 This function is a possible cancellation point and therefore not 183 marked with __THROW. */ 184 extern int fclose (FILE *__stream) __nonnull ((1)); 185 186 #undef __attr_dealloc_fclose 187 #define __attr_dealloc_fclose __attr_dealloc (fclose, 1) 188 189 /* Create a temporary file and open it read/write. 190 191 This function is a possible cancellation point and therefore not 192 marked with __THROW. */ 193 #ifndef __USE_FILE_OFFSET64 194 extern FILE *tmpfile (void) 195 __attribute_malloc__ __attr_dealloc_fclose __wur; 196 #else 197 # ifdef __REDIRECT 198 extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) 199 __attribute_malloc__ __attr_dealloc_fclose __wur; 200 # else 201 # define tmpfile tmpfile64 202 # endif 203 #endif 204 205 #ifdef __USE_LARGEFILE64 206 extern FILE *tmpfile64 (void) 207 __attribute_malloc__ __attr_dealloc_fclose __wur; 208 #endif 209 210 /* Generate a temporary filename. */ 211 extern char *tmpnam (char[L_tmpnam]) __THROW __wur; 212 213 #ifdef __USE_MISC 214 /* This is the reentrant variant of `tmpnam'. The only difference is 215 that it does not allow S to be NULL. */ 216 extern char *tmpnam_r (char __s[L_tmpnam]) __THROW __wur; 217 #endif 218 219 220 #if defined __USE_MISC || defined __USE_XOPEN 221 /* Generate a unique temporary filename using up to five characters of PFX 222 if it is not NULL. The directory to put this file in is searched for 223 as follows: First the environment variable "TMPDIR" is checked. 224 If it contains the name of a writable directory, that directory is used. 225 If not and if DIR is not NULL, that value is checked. If that fails, 226 P_tmpdir is tried and finally "/tmp". The storage for the filename 227 is allocated by `malloc'. */ 228 extern char *tempnam (const char *__dir, const char *__pfx) 229 __THROW __attribute_malloc__ __wur __attr_dealloc_free; 230 #endif 231 232 /* Flush STREAM, or all streams if STREAM is NULL. 233 234 This function is a possible cancellation point and therefore not 235 marked with __THROW. */ 236 extern int fflush (FILE *__stream); 237 238 #ifdef __USE_MISC 239 /* Faster versions when locking is not required. 240 241 This function is not part of POSIX and therefore no official 242 cancellation point. But due to similarity with an POSIX interface 243 or due to the implementation it is a cancellation point and 244 therefore not marked with __THROW. */ 245 extern int fflush_unlocked (FILE *__stream); 246 #endif 247 248 #ifdef __USE_GNU 249 /* Close all streams. 250 251 This function is not part of POSIX and therefore no official 252 cancellation point. But due to similarity with an POSIX interface 253 or due to the implementation it is a cancellation point and 254 therefore not marked with __THROW. */ 255 extern int fcloseall (void); 256 #endif 257 258 259 #ifndef __USE_FILE_OFFSET64 260 /* Open a file and create a new stream for it. 261 262 This function is a possible cancellation point and therefore not 263 marked with __THROW. */ 264 extern FILE *fopen (const char *__restrict __filename, 265 const char *__restrict __modes) 266 __attribute_malloc__ __attr_dealloc_fclose __wur; 267 /* Open a file, replacing an existing stream with it. 268 269 This function is a possible cancellation point and therefore not 270 marked with __THROW. */ 271 extern FILE *freopen (const char *__restrict __filename, 272 const char *__restrict __modes, 273 FILE *__restrict __stream) __wur __nonnull ((3)); 274 #else 275 # ifdef __REDIRECT 276 extern FILE *__REDIRECT (fopen, (const char *__restrict __filename, 277 const char *__restrict __modes), fopen64) 278 __attribute_malloc__ __attr_dealloc_fclose __wur; 279 extern FILE *__REDIRECT (freopen, (const char *__restrict __filename, 280 const char *__restrict __modes, 281 FILE *__restrict __stream), freopen64) 282 __wur __nonnull ((3)); 283 # else 284 # define fopen fopen64 285 # define freopen freopen64 286 # endif 287 #endif 288 #ifdef __USE_LARGEFILE64 289 extern FILE *fopen64 (const char *__restrict __filename, 290 const char *__restrict __modes) 291 __attribute_malloc__ __attr_dealloc_fclose __wur; 292 extern FILE *freopen64 (const char *__restrict __filename, 293 const char *__restrict __modes, 294 FILE *__restrict __stream) __wur __nonnull ((3)); 295 #endif 296 297 #ifdef __USE_POSIX 298 /* Create a new stream that refers to an existing system file descriptor. */ 299 extern FILE *fdopen (int __fd, const char *__modes) __THROW 300 __attribute_malloc__ __attr_dealloc_fclose __wur; 301 #endif 302 303 #ifdef __USE_MISC 304 /* Create a new stream that refers to the given magic cookie, 305 and uses the given functions for input and output. */ 306 extern FILE *fopencookie (void *__restrict __magic_cookie, 307 const char *__restrict __modes, 308 cookie_io_functions_t __io_funcs) __THROW 309 __attribute_malloc__ __attr_dealloc_fclose __wur; 310 #endif 311 312 #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) 313 /* Create a new stream that refers to a memory buffer. */ 314 extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) 315 __THROW __attribute_malloc__ __attr_dealloc_fclose __wur; 316 317 /* Open a stream that writes into a malloc'd buffer that is expanded as 318 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location 319 and the number of characters written on fflush or fclose. */ 320 extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW 321 __attribute_malloc__ __attr_dealloc_fclose __wur; 322 323 #ifdef _WCHAR_H 324 /* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces 325 a wide character string. Declared here only to add attribute malloc 326 and only if
has been previously #included. */ 327 extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW 328 __attribute_malloc__ __attr_dealloc_fclose; 329 # endif 330 #endif 331 332 /* If BUF is NULL, make STREAM unbuffered. 333 Else make it use buffer BUF, of size BUFSIZ. */ 334 extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW 335 __nonnull ((1)); 336 /* Make STREAM use buffering mode MODE. 337 If BUF is not NULL, use N bytes of it for buffering; 338 else allocate an internal buffer N bytes long. */ 339 extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, 340 int __modes, size_t __n) __THROW __nonnull ((1)); 341 342 #ifdef __USE_MISC 343 /* If BUF is NULL, make STREAM unbuffered. 344 Else make it use SIZE bytes of BUF for buffering. */ 345 extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, 346 size_t __size) __THROW __nonnull ((1)); 347 348 /* Make STREAM line-buffered. */ 349 extern void setlinebuf (FILE *__stream) __THROW __nonnull ((1)); 350 #endif 351 352 353 /* Write formatted output to STREAM. 354 355 This function is a possible cancellation point and therefore not 356 marked with __THROW. */ 357 extern int fprintf (FILE *__restrict __stream, 358 const char *__restrict __format, ...) __nonnull ((1)); 359 /* Write formatted output to stdout. 360 361 This function is a possible cancellation point and therefore not 362 marked with __THROW. */ 363 extern int printf (const char *__restrict __format, ...); 364 /* Write formatted output to S. */ 365 extern int sprintf (char *__restrict __s, 366 const char *__restrict __format, ...) __THROWNL; 367 368 /* Write formatted output to S from argument list ARG. 369 370 This function is a possible cancellation point and therefore not 371 marked with __THROW. */ 372 extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, 373 __gnuc_va_list __arg) __nonnull ((1)); 374 /* Write formatted output to stdout from argument list ARG. 375 376 This function is a possible cancellation point and therefore not 377 marked with __THROW. */ 378 extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); 379 /* Write formatted output to S from argument list ARG. */ 380 extern int vsprintf (char *__restrict __s, const char *__restrict __format, 381 __gnuc_va_list __arg) __THROWNL; 382 383 #if defined __USE_ISOC99 || defined __USE_UNIX98 384 /* Maximum chars of output to write in MAXLEN. */ 385 extern int snprintf (char *__restrict __s, size_t __maxlen, 386 const char *__restrict __format, ...) 387 __THROWNL __attribute__ ((__format__ (__printf__, 3, 4))); 388 389 extern int vsnprintf (char *__restrict __s, size_t __maxlen, 390 const char *__restrict __format, __gnuc_va_list __arg) 391 __THROWNL __attribute__ ((__format__ (__printf__, 3, 0))); 392 #endif 393 394 #if defined (__USE_MISC) || __GLIBC_USE (LIB_EXT2) 395 /* Write formatted output to a string dynamically allocated with `malloc'. 396 Store the address of the string in *PTR. */ 397 extern int vasprintf (char **__restrict __ptr, const char *__restrict __f, 398 __gnuc_va_list __arg) 399 __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur; 400 extern int __asprintf (char **__restrict __ptr, 401 const char *__restrict __fmt, ...) 402 __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur; 403 extern int asprintf (char **__restrict __ptr, 404 const char *__restrict __fmt, ...) 405 __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur; 406 #endif 407 408 #ifdef __USE_XOPEN2K8 409 /* Write formatted output to a file descriptor. */ 410 extern int vdprintf (int __fd, const char *__restrict __fmt, 411 __gnuc_va_list __arg) 412 __attribute__ ((__format__ (__printf__, 2, 0))); 413 extern int dprintf (int __fd, const char *__restrict __fmt, ...) 414 __attribute__ ((__format__ (__printf__, 2, 3))); 415 #endif 416 417 418 /* Read formatted input from STREAM. 419 420 This function is a possible cancellation point and therefore not 421 marked with __THROW. */ 422 extern int fscanf (FILE *__restrict __stream, 423 const char *__restrict __format, ...) __wur __nonnull ((1)); 424 /* Read formatted input from stdin. 425 426 This function is a possible cancellation point and therefore not 427 marked with __THROW. */ 428 extern int scanf (const char *__restrict __format, ...) __wur; 429 /* Read formatted input from S. */ 430 extern int sscanf (const char *__restrict __s, 431 const char *__restrict __format, ...) __THROW; 432 433 /* For historical reasons, the C99-compliant versions of the scanf 434 functions are at alternative names. When __LDBL_COMPAT or 435 __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in 436 bits/stdio-ldbl.h. */ 437 #include
438 #if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \ 439 && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 440 # if __GLIBC_USE (C2X_STRTOL) 441 # ifdef __REDIRECT 442 extern int __REDIRECT (fscanf, (FILE *__restrict __stream, 443 const char *__restrict __format, ...), 444 __isoc23_fscanf) __wur __nonnull ((1)); 445 extern int __REDIRECT (scanf, (const char *__restrict __format, ...), 446 __isoc23_scanf) __wur; 447 extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s, 448 const char *__restrict __format, ...), 449 __isoc23_sscanf); 450 # else 451 extern int __isoc23_fscanf (FILE *__restrict __stream, 452 const char *__restrict __format, ...) __wur 453 __nonnull ((1)); 454 extern int __isoc23_scanf (const char *__restrict __format, ...) __wur; 455 extern int __isoc23_sscanf (const char *__restrict __s, 456 const char *__restrict __format, ...) __THROW; 457 # define fscanf __isoc23_fscanf 458 # define scanf __isoc23_scanf 459 # define sscanf __isoc23_sscanf 460 # endif 461 # else 462 # ifdef __REDIRECT 463 extern int __REDIRECT (fscanf, (FILE *__restrict __stream, 464 const char *__restrict __format, ...), 465 __isoc99_fscanf) __wur __nonnull ((1)); 466 extern int __REDIRECT (scanf, (const char *__restrict __format, ...), 467 __isoc99_scanf) __wur; 468 extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s, 469 const char *__restrict __format, ...), 470 __isoc99_sscanf); 471 # else 472 extern int __isoc99_fscanf (FILE *__restrict __stream, 473 const char *__restrict __format, ...) __wur 474 __nonnull ((1)); 475 extern int __isoc99_scanf (const char *__restrict __format, ...) __wur; 476 extern int __isoc99_sscanf (const char *__restrict __s, 477 const char *__restrict __format, ...) __THROW; 478 # define fscanf __isoc99_fscanf 479 # define scanf __isoc99_scanf 480 # define sscanf __isoc99_sscanf 481 # endif 482 # endif 483 #endif 484 485 #ifdef __USE_ISOC99 486 /* Read formatted input from S into argument list ARG. 487 488 This function is a possible cancellation point and therefore not 489 marked with __THROW. */ 490 extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, 491 __gnuc_va_list __arg) 492 __attribute__ ((__format__ (__scanf__, 2, 0))) __wur __nonnull ((1)); 493 494 /* Read formatted input from stdin into argument list ARG. 495 496 This function is a possible cancellation point and therefore not 497 marked with __THROW. */ 498 extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) 499 __attribute__ ((__format__ (__scanf__, 1, 0))) __wur; 500 501 /* Read formatted input from S into argument list ARG. */ 502 extern int vsscanf (const char *__restrict __s, 503 const char *__restrict __format, __gnuc_va_list __arg) 504 __THROW __attribute__ ((__format__ (__scanf__, 2, 0))); 505 506 /* Same redirection as above for the v*scanf family. */ 507 # if !__GLIBC_USE (DEPRECATED_SCANF) 508 # if __GLIBC_USE (C2X_STRTOL) 509 # if defined __REDIRECT && !defined __LDBL_COMPAT \ 510 && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 511 extern int __REDIRECT (vfscanf, 512 (FILE *__restrict __s, 513 const char *__restrict __format, __gnuc_va_list __arg), 514 __isoc23_vfscanf) 515 __attribute__ ((__format__ (__scanf__, 2, 0))) __wur __nonnull ((1)); 516 extern int __REDIRECT (vscanf, (const char *__restrict __format, 517 __gnuc_va_list __arg), __isoc23_vscanf) 518 __attribute__ ((__format__ (__scanf__, 1, 0))) __wur; 519 extern int __REDIRECT_NTH (vsscanf, 520 (const char *__restrict __s, 521 const char *__restrict __format, 522 __gnuc_va_list __arg), __isoc23_vsscanf) 523 __attribute__ ((__format__ (__scanf__, 2, 0))); 524 # elif !defined __REDIRECT 525 extern int __isoc23_vfscanf (FILE *__restrict __s, 526 const char *__restrict __format, 527 __gnuc_va_list __arg) __wur __nonnull ((1)); 528 extern int __isoc23_vscanf (const char *__restrict __format, 529 __gnuc_va_list __arg) __wur; 530 extern int __isoc23_vsscanf (const char *__restrict __s, 531 const char *__restrict __format, 532 __gnuc_va_list __arg) __THROW; 533 # define vfscanf __isoc23_vfscanf 534 # define vscanf __isoc23_vscanf 535 # define vsscanf __isoc23_vsscanf 536 # endif 537 # else 538 # if defined __REDIRECT && !defined __LDBL_COMPAT \ 539 && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 540 extern int __REDIRECT (vfscanf, 541 (FILE *__restrict __s, 542 const char *__restrict __format, __gnuc_va_list __arg), 543 __isoc99_vfscanf) 544 __attribute__ ((__format__ (__scanf__, 2, 0))) __wur __nonnull ((1)); 545 extern int __REDIRECT (vscanf, (const char *__restrict __format, 546 __gnuc_va_list __arg), __isoc99_vscanf) 547 __attribute__ ((__format__ (__scanf__, 1, 0))) __wur; 548 extern int __REDIRECT_NTH (vsscanf, 549 (const char *__restrict __s, 550 const char *__restrict __format, 551 __gnuc_va_list __arg), __isoc99_vsscanf) 552 __attribute__ ((__format__ (__scanf__, 2, 0))); 553 # elif !defined __REDIRECT 554 extern int __isoc99_vfscanf (FILE *__restrict __s, 555 const char *__restrict __format, 556 __gnuc_va_list __arg) __wur __nonnull ((1)); 557 extern int __isoc99_vscanf (const char *__restrict __format, 558 __gnuc_va_list __arg) __wur; 559 extern int __isoc99_vsscanf (const char *__restrict __s, 560 const char *__restrict __format, 561 __gnuc_va_list __arg) __THROW; 562 # define vfscanf __isoc99_vfscanf 563 # define vscanf __isoc99_vscanf 564 # define vsscanf __isoc99_vsscanf 565 # endif 566 # endif 567 # endif 568 #endif /* Use ISO C9x. */ 569 570 571 /* Read a character from STREAM. 572 573 These functions are possible cancellation points and therefore not 574 marked with __THROW. */ 575 extern int fgetc (FILE *__stream) __nonnull ((1)); 576 extern int getc (FILE *__stream) __nonnull ((1)); 577 578 /* Read a character from stdin. 579 580 This function is a possible cancellation point and therefore not 581 marked with __THROW. */ 582 extern int getchar (void); 583 584 #ifdef __USE_POSIX199506 585 /* These are defined in POSIX.1:1996. 586 587 These functions are possible cancellation points and therefore not 588 marked with __THROW. */ 589 extern int getc_unlocked (FILE *__stream) __nonnull ((1)); 590 extern int getchar_unlocked (void); 591 #endif /* Use POSIX. */ 592 593 #ifdef __USE_MISC 594 /* Faster version when locking is not necessary. 595 596 This function is not part of POSIX and therefore no official 597 cancellation point. But due to similarity with an POSIX interface 598 or due to the implementation it is a cancellation point and 599 therefore not marked with __THROW. */ 600 extern int fgetc_unlocked (FILE *__stream) __nonnull ((1)); 601 #endif /* Use MISC. */ 602 603 604 /* Write a character to STREAM. 605 606 These functions are possible cancellation points and therefore not 607 marked with __THROW. 608 609 These functions is a possible cancellation point and therefore not 610 marked with __THROW. */ 611 extern int fputc (int __c, FILE *__stream) __nonnull ((2)); 612 extern int putc (int __c, FILE *__stream) __nonnull ((2)); 613 614 /* Write a character to stdout. 615 616 This function is a possible cancellation point and therefore not 617 marked with __THROW. */ 618 extern int putchar (int __c); 619 620 #ifdef __USE_MISC 621 /* Faster version when locking is not necessary. 622 623 This function is not part of POSIX and therefore no official 624 cancellation point. But due to similarity with an POSIX interface 625 or due to the implementation it is a cancellation point and 626 therefore not marked with __THROW. */ 627 extern int fputc_unlocked (int __c, FILE *__stream) __nonnull ((2)); 628 #endif /* Use MISC. */ 629 630 #ifdef __USE_POSIX199506 631 /* These are defined in POSIX.1:1996. 632 633 These functions are possible cancellation points and therefore not 634 marked with __THROW. */ 635 extern int putc_unlocked (int __c, FILE *__stream) __nonnull ((2)); 636 extern int putchar_unlocked (int __c); 637 #endif /* Use POSIX. */ 638 639 640 #if defined __USE_MISC \ 641 || (defined __USE_XOPEN && !defined __USE_XOPEN2K) 642 /* Get a word (int) from STREAM. */ 643 extern int getw (FILE *__stream) __nonnull ((1)); 644 645 /* Write a word (int) to STREAM. */ 646 extern int putw (int __w, FILE *__stream) __nonnull ((2)); 647 #endif 648 649 650 /* Get a newline-terminated string of finite length from STREAM. 651 652 This function is a possible cancellation point and therefore not 653 marked with __THROW. */ 654 extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) 655 __wur __fortified_attr_access (__write_only__, 1, 2) __nonnull ((3)); 656 657 #if __GLIBC_USE (DEPRECATED_GETS) 658 /* Get a newline-terminated string from stdin, removing the newline. 659 660 This function is impossible to use safely. It has been officially 661 removed from ISO C11 and ISO C++14, and we have also removed it 662 from the _GNU_SOURCE feature list. It remains available when 663 explicitly using an old ISO C, Unix, or POSIX standard. 664 665 This function is a possible cancellation point and therefore not 666 marked with __THROW. */ 667 extern char *gets (char *__s) __wur __attribute_deprecated__; 668 #endif 669 670 #ifdef __USE_GNU 671 /* This function does the same as `fgets' but does not lock the stream. 672 673 This function is not part of POSIX and therefore no official 674 cancellation point. But due to similarity with an POSIX interface 675 or due to the implementation it is a cancellation point and 676 therefore not marked with __THROW. */ 677 extern char *fgets_unlocked (char *__restrict __s, int __n, 678 FILE *__restrict __stream) __wur 679 __fortified_attr_access (__write_only__, 1, 2) __nonnull ((3)); 680 #endif 681 682 683 #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) 684 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR 685 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or 686 NULL), pointing to *N characters of space. It is realloc'd as 687 necessary. Returns the number of characters read (not including the 688 null terminator), or -1 on error or EOF. 689 690 These functions are not part of POSIX and therefore no official 691 cancellation point. But due to similarity with an POSIX interface 692 or due to the implementation they are cancellation points and 693 therefore not marked with __THROW. */ 694 extern __ssize_t __getdelim (char **__restrict __lineptr, 695 size_t *__restrict __n, int __delimiter, 696 FILE *__restrict __stream) __wur __nonnull ((4)); 697 extern __ssize_t getdelim (char **__restrict __lineptr, 698 size_t *__restrict __n, int __delimiter, 699 FILE *__restrict __stream) __wur __nonnull ((4)); 700 701 /* Like `getdelim', but reads up to a newline. 702 703 This function is not part of POSIX and therefore no official 704 cancellation point. But due to similarity with an POSIX interface 705 or due to the implementation it is a cancellation point and 706 therefore not marked with __THROW. */ 707 extern __ssize_t getline (char **__restrict __lineptr, 708 size_t *__restrict __n, 709 FILE *__restrict __stream) __wur __nonnull ((3)); 710 #endif 711 712 713 /* Write a string to STREAM. 714 715 This function is a possible cancellation point and therefore not 716 marked with __THROW. */ 717 extern int fputs (const char *__restrict __s, FILE *__restrict __stream) 718 __nonnull ((2)); 719 720 /* Write a string, followed by a newline, to stdout. 721 722 This function is a possible cancellation point and therefore not 723 marked with __THROW. */ 724 extern int puts (const char *__s); 725 726 727 /* Push a character back onto the input buffer of STREAM. 728 729 This function is a possible cancellation point and therefore not 730 marked with __THROW. */ 731 extern int ungetc (int __c, FILE *__stream) __nonnull ((2)); 732 733 734 /* Read chunks of generic data from STREAM. 735 736 This function is a possible cancellation point and therefore not 737 marked with __THROW. */ 738 extern size_t fread (void *__restrict __ptr, size_t __size, 739 size_t __n, FILE *__restrict __stream) __wur 740 __nonnull((4)); 741 /* Write chunks of generic data to STREAM. 742 743 This function is a possible cancellation point and therefore not 744 marked with __THROW. */ 745 extern size_t fwrite (const void *__restrict __ptr, size_t __size, 746 size_t __n, FILE *__restrict __s) __nonnull((4)); 747 748 #ifdef __USE_GNU 749 /* This function does the same as `fputs' but does not lock the stream. 750 751 This function is not part of POSIX and therefore no official 752 cancellation point. But due to similarity with an POSIX interface 753 or due to the implementation it is a cancellation point and 754 therefore not marked with __THROW. */ 755 extern int fputs_unlocked (const char *__restrict __s, 756 FILE *__restrict __stream) __nonnull ((2)); 757 #endif 758 759 #ifdef __USE_MISC 760 /* Faster versions when locking is not necessary. 761 762 These functions are not part of POSIX and therefore no official 763 cancellation point. But due to similarity with an POSIX interface 764 or due to the implementation they are cancellation points and 765 therefore not marked with __THROW. */ 766 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, 767 size_t __n, FILE *__restrict __stream) __wur 768 __nonnull ((4)); 769 extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, 770 size_t __n, FILE *__restrict __stream) 771 __nonnull ((4)); 772 #endif 773 774 775 /* Seek to a certain position on STREAM. 776 777 This function is a possible cancellation point and therefore not 778 marked with __THROW. */ 779 extern int fseek (FILE *__stream, long int __off, int __whence) 780 __nonnull ((1)); 781 /* Return the current position of STREAM. 782 783 This function is a possible cancellation point and therefore not 784 marked with __THROW. */ 785 extern long int ftell (FILE *__stream) __wur __nonnull ((1)); 786 /* Rewind to the beginning of STREAM. 787 788 This function is a possible cancellation point and therefore not 789 marked with __THROW. */ 790 extern void rewind (FILE *__stream) __nonnull ((1)); 791 792 /* The Single Unix Specification, Version 2, specifies an alternative, 793 more adequate interface for the two functions above which deal with 794 file offset. `long int' is not the right type. These definitions 795 are originally defined in the Large File Support API. */ 796 797 #if defined __USE_LARGEFILE || defined __USE_XOPEN2K 798 # ifndef __USE_FILE_OFFSET64 799 /* Seek to a certain position on STREAM. 800 801 This function is a possible cancellation point and therefore not 802 marked with __THROW. */ 803 extern int fseeko (FILE *__stream, __off_t __off, int __whence) 804 __nonnull ((1)); 805 /* Return the current position of STREAM. 806 807 This function is a possible cancellation point and therefore not 808 marked with __THROW. */ 809 extern __off_t ftello (FILE *__stream) __wur __nonnull ((1)); 810 # else 811 # ifdef __REDIRECT 812 extern int __REDIRECT (fseeko, 813 (FILE *__stream, __off64_t __off, int __whence), 814 fseeko64) __nonnull ((1)); 815 extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64) 816 __nonnull ((1)); 817 # else 818 # define fseeko fseeko64 819 # define ftello ftello64 820 # endif 821 # endif 822 #endif 823 824 #ifndef __USE_FILE_OFFSET64 825 /* Get STREAM's position. 826 827 This function is a possible cancellation point and therefore not 828 marked with __THROW. */ 829 extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos) 830 __nonnull ((1)); 831 /* Set STREAM's position. 832 833 This function is a possible cancellation point and therefore not 834 marked with __THROW. */ 835 extern int fsetpos (FILE *__stream, const fpos_t *__pos) __nonnull ((1)); 836 #else 837 # ifdef __REDIRECT 838 extern int __REDIRECT (fgetpos, (FILE *__restrict __stream, 839 fpos_t *__restrict __pos), fgetpos64) 840 __nonnull ((1)); 841 extern int __REDIRECT (fsetpos, 842 (FILE *__stream, const fpos_t *__pos), fsetpos64) 843 __nonnull ((1)); 844 # else 845 # define fgetpos fgetpos64 846 # define fsetpos fsetpos64 847 # endif 848 #endif 849 850 #ifdef __USE_LARGEFILE64 851 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence) 852 __nonnull ((1)); 853 extern __off64_t ftello64 (FILE *__stream) __wur __nonnull ((1)); 854 extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos) 855 __nonnull ((1)); 856 extern int fsetpos64 (FILE *__stream, const fpos64_t *__pos) __nonnull ((1)); 857 #endif 858 859 /* Clear the error and EOF indicators for STREAM. */ 860 extern void clearerr (FILE *__stream) __THROW __nonnull ((1)); 861 /* Return the EOF indicator for STREAM. */ 862 extern int feof (FILE *__stream) __THROW __wur __nonnull ((1)); 863 /* Return the error indicator for STREAM. */ 864 extern int ferror (FILE *__stream) __THROW __wur __nonnull ((1)); 865 866 #ifdef __USE_MISC 867 /* Faster versions when locking is not required. */ 868 extern void clearerr_unlocked (FILE *__stream) __THROW __nonnull ((1)); 869 extern int feof_unlocked (FILE *__stream) __THROW __wur __nonnull ((1)); 870 extern int ferror_unlocked (FILE *__stream) __THROW __wur __nonnull ((1)); 871 #endif 872 873 874 /* Print a message describing the meaning of the value of errno. 875 876 This function is a possible cancellation point and therefore not 877 marked with __THROW. */ 878 extern void perror (const char *__s) __COLD; 879 880 881 #ifdef __USE_POSIX 882 /* Return the system file descriptor for STREAM. */ 883 extern int fileno (FILE *__stream) __THROW __wur __nonnull ((1)); 884 #endif /* Use POSIX. */ 885 886 #ifdef __USE_MISC 887 /* Faster version when locking is not required. */ 888 extern int fileno_unlocked (FILE *__stream) __THROW __wur __nonnull ((1)); 889 #endif 890 891 892 #ifdef __USE_POSIX2 893 /* Close a stream opened by popen and return the status of its child. 894 895 This function is a possible cancellation point and therefore not 896 marked with __THROW. */ 897 extern int pclose (FILE *__stream) __nonnull ((1)); 898 899 /* Create a new stream connected to a pipe running the given command. 900 901 This function is a possible cancellation point and therefore not 902 marked with __THROW. */ 903 extern FILE *popen (const char *__command, const char *__modes) 904 __attribute_malloc__ __attr_dealloc (pclose, 1) __wur; 905 906 #endif 907 908 909 #ifdef __USE_POSIX 910 /* Return the name of the controlling terminal. */ 911 extern char *ctermid (char *__s) __THROW 912 __attr_access ((__write_only__, 1)); 913 #endif /* Use POSIX. */ 914 915 916 #if (defined __USE_XOPEN && !defined __USE_XOPEN2K) || defined __USE_GNU 917 /* Return the name of the current user. */ 918 extern char *cuserid (char *__s) 919 __attr_access ((__write_only__, 1)); 920 #endif /* Use X/Open, but not issue 6. */ 921 922 923 #ifdef __USE_GNU 924 struct obstack; /* See
. */ 925 926 /* Write formatted output to an obstack. */ 927 extern int obstack_printf (struct obstack *__restrict __obstack, 928 const char *__restrict __format, ...) 929 __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))); 930 extern int obstack_vprintf (struct obstack *__restrict __obstack, 931 const char *__restrict __format, 932 __gnuc_va_list __args) 933 __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))); 934 #endif /* Use GNU. */ 935 936 937 #ifdef __USE_POSIX199506 938 /* These are defined in POSIX.1:1996. */ 939 940 /* Acquire ownership of STREAM. */ 941 extern void flockfile (FILE *__stream) __THROW __nonnull ((1)); 942 943 /* Try to acquire ownership of STREAM but do not block if it is not 944 possible. */ 945 extern int ftrylockfile (FILE *__stream) __THROW __wur __nonnull ((1)); 946 947 /* Relinquish the ownership granted for STREAM. */ 948 extern void funlockfile (FILE *__stream) __THROW __nonnull ((1)); 949 #endif /* POSIX */ 950 951 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU 952 /* X/Open Issues 1-5 required getopt to be declared in this 953 header. It was removed in Issue 6. GNU follows Issue 6. */ 954 # include
955 #endif 956 957 /* Slow-path routines used by the optimized inline functions in 958 bits/stdio.h. */ 959 extern int __uflow (FILE *); 960 extern int __overflow (FILE *, int); 961 962 #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function 963 /* Declare all functions from bits/stdio2-decl.h first. */ 964 # include
965 #endif 966 967 /* The following headers provide asm redirections. These redirections must 968 appear before the first usage of these functions, e.g. in bits/stdio.h. */ 969 #if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 970 # include
971 #endif 972 973 /* If we are compiling with optimizing read this file. It contains 974 several optimizing inline functions and macros. */ 975 #ifdef __USE_EXTERN_INLINES 976 # include
977 #endif 978 #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function 979 /* Now include the function definitions and redirects too. */ 980 # include
981 #endif 982 983 __END_DECLS 984 985 #endif /*
included. */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™