Files
2025-10-25 03:02:53 +03:00

43 lines
4.0 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[cstdio.syn]
# 31 Input/output library [[input.output]](./#input.output)
## 31.13 C library files [[c.files]](c.files#cstdio.syn)
### 31.13.1 Header <cstdio> synopsis [cstdio.syn]
[🔗](#header:%3ccstdio%3e)
#define __STDC_VERSION_STDIO_H__ 202311Lnamespace std {using size_t = *see [[support.types.layout]](support.types.layout "17.2.4Sizes, alignments, and offsets")*; using FILE = *see below*; using fpos_t = *see below*;}#define NULL *see [[support.types.nullptr]](support.types.nullptr "17.2.3Null pointers")*#define _IOFBF *see below*#define _IOLBF *see below*#define _IONBF *see below*#define BUFSIZ *see below*#define EOF *see below*#define FOPEN_MAX *see below*#define FILENAME_MAX *see below*#define _PRINTF_NAN_LEN_MAX *see below*#define L_tmpnam *see below*#define SEEK_CUR *see below*#define SEEK_END *see below*#define SEEK_SET *see below*#define TMP_MAX *see below*#define stderr *see below*#define stdin *see below*#define stdout *see below*namespace std {int remove(const char* filename); int rename(const char* old_p, const char* new_p);
FILE* tmpfile(); char* tmpnam(char* s); int fclose(FILE* stream); int fflush(FILE* stream);
FILE* fopen(const char* filename, const char* mode);
FILE* freopen(const char* filename, const char* mode, FILE* stream); void setbuf(FILE* stream, char* buf); int setvbuf(FILE* stream, char* buf, int mode, size_t size); int fprintf(FILE* stream, const char* format, ...); int fscanf(FILE* stream, const char* format, ...); int printf(const char* format, ...); int scanf(const char* format, ...); int snprintf(char* s, size_t n, const char* format, ...); int sprintf(char* s, const char* format, ...); int sscanf(const char* s, const char* format, ...); int vfprintf(FILE* stream, const char* format, va_list arg); int vfscanf(FILE* stream, const char* format, va_list arg); int vprintf(const char* format, va_list arg); int vscanf(const char* format, va_list arg); int vsnprintf(char* s, size_t n, const char* format, va_list arg); int vsprintf(char* s, const char* format, va_list arg); int vsscanf(const char* s, const char* format, va_list arg); int fgetc(FILE* stream); char* fgets(char* s, int n, FILE* stream); int fputc(int c, FILE* stream); int fputs(const char* s, FILE* stream); int getc(FILE* stream); int getchar(); int putc(int c, FILE* stream); int putchar(int c); int puts(const char* s); int ungetc(int c, FILE* stream);
size_t fread(void* ptr, size_t size, size_t nmemb, FILE* stream);
size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream); int fgetpos(FILE* stream, fpos_t* pos); int fseek(FILE* stream, long int offset, int whence); int fsetpos(FILE* stream, const fpos_t* pos); long int ftell(FILE* stream); void rewind(FILE* stream); void clearerr(FILE* stream); int feof(FILE* stream); int ferror(FILE* stream); void perror(const char* s);}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18970)
The contents and meaning of the header [<cstdio>](#header:%3ccstdio%3e "31.13.1Header <cstdio> synopsis[cstdio.syn]") are the same as the C standard library header [<stdio.h>](support.c.headers.general#header:%3cstdio.h%3e "17.15.1General[support.c.headers.general]")[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18974)
The return from each function call
that delivers data
to the host environment
to be written to a file (See also: ISO/IEC 9899:2024, 7.21.3)
is an observable checkpoint ([[intro.abstract]](intro.abstract "4.1.2Abstract machine"))[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18981)
Calls to the function tmpnam with an argument that is a null pointer value may
introduce a data race ([[res.on.data.races]](res.on.data.races "16.4.6.10Data race avoidance")) with other calls to tmpnam with
an argument that is a null pointer value[.](#3.sentence-1)
See also: ISO/IEC 9899:2024, 7.23