Benutzer:Diaspomod/stdio
aus Wikipedia, der freien Enzyklopädie
Funktionen
Die meisten Ein- / Ausgabefunktionen für C-Dateien sind in stdio.h definiert (oder im C ++ - Header cstdio, der die Standard-C-Funktionalität enthält, jedoch im std-Namespace).
Byte character |
Wide character |
Description | |
---|---|---|---|
File access | fopen | Opens a file (with a non-Unicode filename on Windows and possible UTF-8 filename on Linux) | |
freopen | Opens a different file with an existing stream | ||
fflush | Synchronizes an output stream with the actual file | ||
fclose | Closes a file | ||
setbuf | Sets the buffer for a file stream | ||
setvbuf | Sets the buffer and its size for a file stream | ||
fwide | Switches a file stream between wide-character I/O and narrow-character I/O | ||
Direct input/output |
fread | Reads from a file | |
fwrite | Writes to a file | ||
Unformatted input/output |
fgetc getc |
fgetwc getwc |
Reads a byte/wchar_t from a file stream |
fgets | fgetws | Reads a byte/wchar_t line from a file stream | |
fputc putc |
fputwc putwc |
Writes a byte/wchar_t to a file stream | |
fputs | fputws | Writes a byte/wchar_t string to a file stream | |
getchar | getwchar | Reads a byte/wchar_t from stdin | |
Vorlage:N/a | Reads a byte string from stdin until a newline or end of file is encountered (deprecated in C99, removed from C11) | ||
putchar | putwchar | Writes a byte/wchar_t to stdout | |
puts | Vorlage:N/a | Writes a byte string to stdout | |
ungetc | ungetwc | Puts a byte/wchar_t back into a file stream | |
Formatted input/output |
scanf fscanf sscanf |
wscanf fwscanf swscanf |
Reads formatted byte/wchar_t input from stdin, a file stream or a buffer |
vscanf vfscanf vsscanf |
vwscanf vfwscanf vswscanf |
Reads formatted input byte/wchar_t from stdin, a file stream or a buffer using variable argument list | |
printf fprintf sprintf snprintf |
wprintf fwprintf swprintf |
Prints formatted byte/wchar_t output to stdout, a file stream or a buffer | |
vprintf vfprintf vsprintf vsnprintf |
vwprintf vfwprintf vswprintf |
Prints formatted byte/wchar_t output to stdout, a file stream, or a buffer using variable argument list | |
perror | Vorlage:N/a | Writes a description of the current error to stderr | |
File positioning | ftell ftello |
Returns the current file position indicator | |
fseek fseeko |
Moves the file position indicator to a specific location in a file | ||
fgetpos | Gets the file position indicator | ||
fsetpos | Moves the file position indicator to a specific location in a file | ||
rewind | Moves the file position indicator to the beginning in a file | ||
Error handling |
clearerr | Clears errors | |
feof | Checks for the end-of-file | ||
ferror | Checks for a file error | ||
Operations on files |
remove | Erases a file | |
rename | Renames a file | ||
tmpfile | Returns a pointer to a temporary file | ||
tmpnam | Returns a unique filename |