hvn-network

My Blog List

Tuesday, September 6, 2016

C standard library stdio.h

C Library - <stdio.h>

The stdio.h header defines three variable types, several macros, and various functions for performing input and output.

Library Variables

size_t
This is the unsigned integral type and is the result of the sizeof keyword.
FILE
This is an object type suitable for storing information for a file stream.
fpos_t
This is an object type suitable for storing any position in a file.

Library Macros

NULL
This macro is the value of a null pointer constant.
_IOFBF, _IOLBF and _IONBF
These are the macros which expand to integral constant expressions with distinct values and suitable for the use as third argument to the setvbuf function.
BUFSIZ
This macro is an integer, which represents the size of the buffer used by thesetbuf function.
EOF
This macro is a negative integer, which indicates that the end-of-file has been reached.
FOPEN_MAX
This macro is an integer, which represents the maximum number of files that the system can guarantee to be opened simultaneously.
FILENAME_MAX
This macro 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
This macro is an integer, which represents the longest length of a char array suitable for holding the longest possible temporary filename created by thetmpnam function.
SEEK_CUR, SEEK_END, and SEEK_SET
These macros are used in the fseek function to locate different positions in a file.
TMP_MAX
This macro is the maximum number of unique filenames that the functiontmpnam can generate.
stderr, stdin, and stdout
These macros are pointers to FILE types which correspond to the standard error, standard input, and standard output streams.

Library Functions

Closes the stream. All buffers are flushed.
Clears the end-of-file and error indicators for the given stream.
Tests the end-of-file indicator for the given stream.
Tests the error indicator for the given stream.
Flushes the output buffer of a stream.
Gets the current file position of the stream and writes it to pos.
Opens the filename pointed to by filename using the given mode.
Reads data from the given stream into the array pointed to by ptr.
Associates a new filename with the given open stream and same time closing the old file in stream.
Sets the file position of the stream to the given offset. The argument offsetsignifies the number of bytes to seek from the given whence position.
Sets the file position of the given stream to the given position. The argument posis a position given by the function fgetpos.
Returns the current file position of the given stream.
Writes data from the array pointed to by ptr to the given stream.
Deletes the given filename so that it is no longer accessible.
Causes the filename referred to, by old_filename to be changed to new_filename.
Sets the file position to the beginning of the file of the given stream.
Defines how a stream should be buffered.
Another function to define how a stream should be buffered.
Creates a temporary file in binary update mode (wb+).
Generates and returns a valid temporary filename which does not exist.
Sends formatted output to a stream.
Sends formatted output to stdout.
Sends formatted output to a string.
Sends formatted output to a stream using an argument list.
Sends formatted output to stdout using an argument list.
Sends formatted output to a string using an argument list.
Reads formatted input from a stream.
Reads formatted input from stdin.
Reads formatted input from a string.
Gets the next character (an unsigned char) from the specified stream and advances the position indicator for the stream.
Reads a line from the specified stream and stores it into the string pointed to by str. It stops when either (n-1) characters are read, the newline character is read, or the end-of-file is reached, whichever comes first.
Writes a character (an unsigned char) specified by the argument char to the specified stream and advances the position indicator for the stream.
Writes a string to the specified stream up to but not including the null character.
Gets the next character (an unsigned char) from the specified stream and advances the position indicator for the stream.
Gets a character (an unsigned char) from stdin.
Reads a line from stdin and stores it into the string pointed to by, str. It stops when either the newline character is read or when the end-of-file is reached, whichever comes first.
Writes a character (an unsigned char) specified by the argument char to the specified stream and advances the position indicator for the stream.
Writes a character (an unsigned char) specified by the argument char to stdout.
Writes a string to stdout up to but not including the null character. A newline character is appended to the output.
Pushes the character char (an unsigned char) onto the specified stream so that the next character is read.
Prints a descriptive error message to stderr. First the string str is printed followed by a colon and then a space.

No comments:

Post a Comment