Bir stdio.h üstbilgi dosyası, giriş ve çıkış işlemlerini gerçekleştirmek için C standart kütüphane işlevleri içerir. Stdin, stdout ve stderr'de ve dosya üzerinde giriş ve çıkış işlemleri gerçekleştiren fonksiyonları içerir. Getchar gibi özel bir veri türü için özel olarak tanımlanan işlevleri ve printf ve scanf gibi genel işlevleri içerir.
Click on function names below to see detailed description of functions.
Function | Description |
---|---|
clearerr | Clears error indicators associated with a given stream. |
fclose | Closes the stream and flushes buffers associated with the given stream. |
feof | Checks the end-of-file indicator of the given stream. |
ferror | Checks the error indicator of the given stream. |
fflush | Flushes the content of the given stream. |
fgetc | Gets the next character from the given stream. |
fgetpos | Gets current position of the given stream. |
fgets | Reads a line from given stream and stores it into a character array. |
fopen | Opens a file in the given mode. |
fprintf | Writes formatted output to a stream. |
fputc | Writes a character to the given stream. |
fputs | Writes a string to the given stream excluding the null terminating character. |
fread | Reads data from the given stream and stores it into an array. |
freopen | Reopens a stream with different file or mode. |
fscanf | Read formatted data from given stream. |
fseek | Changes the position indicator of the given stream. |
fsetpos | Sets the position indicator of the given stream. |
ftell | Returns the current position of the given stream. |
fwrite | Writes data from an array to the given stream. |
getc | Gets the next character from the given stream and increments the position indicator. |
getchar | Returns a character from stdin stream. |
gets | Reads a line from stdin and stores it into given character array. |
perror | Prints an error message to stderr. |
printf | Print formatted data to stdout. |
putc | Writes a character to the given stream and increment the position indicator. |
putchar | Writes a character to stdout stream. |
puts | Writes a string to stdout stream excluding null terminating character. |
remove | Deletes a file. |
rename | Changes the name of an existing file. |
rewind | Reset the position indicator to the beginning of the file. |
scanf | Reads formatted data from stdin. |
setbuf | Sets buffer for the given stream. |
setvbuf | Sets buffer for the given stream with various buffering modes. |
sprintf | Writes formatted data to given string. |
sscanf | Reads formatted data from given string. |
tmpfile | Creates a temporary file having unique file name. |
tmpnam | Generates and unique and valid temporary filename. |
ungetc | Pushes a character back to the given stream. |
vfprintf | Writes formatted data to a stream using an argument list. |
vprintf | Print formatted data to stdout using an argument list. |
vsprintf | Writes formatted data to a string using an argument list. |
Types | Description |
---|---|
fpos_t | An object used for storing any position within a file. |
FILE | An object containing information of a file or stream. |
size_t | An unsigned integral type. |
The stdio header provides functions for performing input and output.
Macros:
NULL _IOFBF _IOLBF _IONBF BUFSIZ EOF FOPEN_MAX FILENAME_MAX L_tmpnam SEEK_CUR SEEK_END SEEK_SET TMP_MAX stderr stdin stdout
Functions:
clearerr(); fclose(); feof(); ferror(); fflush(); fgetpos(); fopen(); fread(); freopen(); fseek(); fsetpos(); ftell(); fwrite(); remove(); rename(); rewind(); setbuf(); setvbuf(); tmpfile(); tmpnam(); fprintf(); fscanf(); printf(); scanf(); sprintf(); sscanf(); vfprintf(); vprintf(); vsprintf(); fgetc(); fgets(); fputc(); fputs(); getc(); getchar(); gets(); putc(); putchar(); puts(); ungetc(); perror();
Variables:
typedef size_t
typedef FILE
typedef fpos_t
size_t is the unsigned integer result of the sizeof keyword.
FILE is a type suitable for storing information for a file stream.
fpos_t is a type suitable for storing any position in a file.
NULL is the value of a null pointer constant.
_IOFBF, _IOLBF, and _IONBF are used in the setvbuf function.
BUFSIZ is an integer which represents the size of the buffer used by the setbuf function.
EOF is a negative integer which indicates an end-of-file has been reached.
FOPEN_MAX is an integer which represents the maximum number of files that the system can guarantee that can be opened simultaneously.
FILENAME_MAX is an integer which represents the longest length of a char array suitable for holding the longest possible filename. If the implementation imposes no limit, then this value should be the recommended maximum value.
L_tmpnam is an integer which represents the longest length of a char array suitable for holding the longest possible temporary filename created by the tmpnam function.
SEEK_CUR, SEEK_END, and SEEK_SET are used in the fseek function.
TMP_MAX is the maximum number of unique filenames that the function tmpnam can generate.
stderr, stdin, and stdout are pointers to FILE types which correspond to the standard error, standard input, and standard output streams.
stdio - standart giriş / çıkış kitaplığı işlevleri
#include <stdio.h>
FILE *stdin;
FILE *stdout;
FILE *stderr;
3 dosya tanımlayıcı, stdin, stdout ve stderr (std = standart) vardır. Bunlar giriş, çıkış ve hata çıkışı için standart akışlardır. Varsayılan olarak, standart girdi klavyeden okunurken, standart çıktı ve standart hata ekrana yazdırılır.
#include <stdio.h>
int getc(FILE *stream);
int getchar(void);
FILE *freopen(const char *pathname, const char *mode, FILE *stream);
int printf(const char *format, ...);
printf() işlevleri çıktıyı stdout’a yazar. getchar() eşdeğeri getc(stdin) dir. getchar() akımdaki bir sonraki karakteri okur ve onu bir int veya dosya sonundaki EOF’ye atanan bir işaretsiz char olarak döndürür.
Bu işaretçiler, işlevler için argüman olarak kullanılabilir. getchar ve putchar gibi bazı işlevler otomatik olarak stdin ve stdout kullanır.
Bu işaretçiler sabittir ve yeni değerler atanamaz. freopen işlevi, akışları disk dosyalarına veya diğer aygıtlara yönlendirmek için kullanılabilir. İşletim sistemi, bir programın standart giriş ve çıkışını komut düzeyinde yönlendirmenizi sağlar.
UNIX/Linux ve Windows Sistemlerinde stdin, stdout ve stderr Dosyaları
1 stdout and 2 stderr yi temsil eder.
grep * 1> & 2
Bu, bir programın stderr çıkışının stdout’tan daha önce aynı dosyalayıcıya yazılmasına neden olacaktır.
Burada, komutun stdout kısmı stderr’a gönderilir.