Monday, October 31, 2016

C Library Function – stdio

The <stdio.h> header shall define the following function(s).

Operations on files Function:
remove int remove(const char * filename);
rename int rename( const char * old_filename, const char * new_filename );
tmpfile(C11) FILE *tmpfile(void);
tmpfile_s(C11) errno_t tmpfile_s(FILE * restrict * restrict streamptr);
tmpnam(C11) char *tmpnam( char *filename );
tmpnam_s(C11) errno_t tmpnam_s(char *filename_s, rsize_t maxsize);

File Access Functions:
fopen FILE * fopen( const char * filename, const char * mode );
fopen_s(C11) errno_t fopen_s(FILE * restrict *restrict streamptr, const char * restrict filename, const char * restrict mode);
freopen FILE * freopen( const char * filename, const char * mode, FILE * stream );
freopen_s(C11) errno_t freopen_s(FILE * restrict *restrict newstreamptr, const char * restrict filename, const char * restrict mode,FILE * restrict stream);
fclose int fclose( FILE * stream );
fflush int fflush( FILE * stream );
setbuf void setbuf( FILE * stream, char *buffer );
setvbuf int setvbuf( FILE * stream, char * buffer, int mode, size_t size );

Formatted input/output Functions:
scanf int scanf( const char * format, ... );
fscanf int fscanf( FILE * stream, const char * format, ... );
sscanf int sscanf( const char * buffer, const char * format, ... );
scanf_s(C11) int scanf_s(const char * restrict format, ...);
fscanf_s(C11) int fscanf_s(FILE * restrict stream, const char * restrict format, ...);
sscanf_s(C11) int sscanf_s(const char * restrict buffer, const char * restrict format, ...);
vscanf(C99) int vscanf( const char * restrict format, va_list arg );
vfscanf(C99) int vfscanf( FILE * restrict stream, const char * restrict format, va_list arg);
vsscanf(C99) int vsscanf( const char * restrict buffer, const char * restrict format, va_list arg);
vscanf_s(C11) int vscanf_s(const char * restrict format, va_list arg);
vfscanf_s(C11) int vfscanf_s( FILE * restrict stream, const char * restrict format, va_list arg);
vsscanf_s(C11) int vsscanf_s( const char * restrict buffer, const char * restrict format, va_list arg);
printf int printf( const char * format, ... );
fprintf int fprintf( FILE * stream, const char * format, ... );
sprintf int sprintf( char *buffer, const char * format, ... );
snprintf(C99) int snprintf( char *restrict buffer, int bufsz, const char * restrict format, ... );
printf_s(C11) int printf_s(const char * restrict format, ...);
fprintf_s(C11) int fprintf_s(FILE * restrict stream, const char * restrict format, ...);
sprintf_s(C11) int sprintf_s(char *restrict buffer, rsize_t bufsz, const char * restrict format, ...);
snprintf_s(C11) int snprintf_s(char *restrict buffer, rsize_t bufsz, const char * restrict format, ...);
vprintf int vprintf( const char * format, va_list arg);
vfprintf int vfprintf( FILE * stream, const char * format, va_list arg);
vsprintf int vsprintf( char *buffer, const char * format, va_list arg);
vsnprintf(C99) int vsnprintf( char *restrict buffer, int bufsz, const char * restrict format, va_list arg);
vprintf_s(C11) int vprintf_s( const char * restrict format, va_list arg);
vfprintf_s(C11) int vfprintf_s( FILE * restrict stream, const char * restrict format, va_list arg);
vsprintf_s(C11) int vsprintf_s( char *restrict buffer, rsize_t bufsz, const char * restrict format, va_list arg);
vsnprintf_s(C11) int vsnprintf_s(char *restrict buffer, rsize_t bufsz, const char * restrict format, va_list arg);

Character input/output Functions:
fgetc int fgetc( FILE * stream );
getc int getc( FILE * stream );
fgets char *fgets( char *str, int count, FILE *stream );
fputc int fputc( int ch, FILE * stream );
putc int putc( int ch, FILE * stream );
fputs int fputs( const char * str, FILE * stream );
getchar int getchar(void);
gets char *gets( char *str );
gets_s(C11) char *gets_s( char *str, rsize_t n );
putchar int putchar( int ch );
puts int puts( const char * str );
ungetc int ungetc( int ch, FILE * stream );

Direct input/output Functions:
fread size_t fread( void *buffer, size_t size, size_t count, FILE * stream );
fwrite size_t fwrite( const void *buffer, size_t size, size_t count, FILE * stream );

File positioning Functions:
ftell long ftell( FILE * stream );
fgetpos int fgetpos( FILE * stream, fpos_t *pos );
fseek int fseek( FILE * stream, long offset, int origin );
fsetpos int fsetpos( FILE * stream, const fpos_t *pos );
rewind void rewind( FILE * stream );

Error-handling Functions:
clearerr void clearerr( FILE * stream );
feof int feof( FILE * stream );
ferror int ferror( FILE * stream );
perror void perror( const char * s );



Related topics:
Library Functions in C   |   Standard Library in C   |   Header Files in C   |   Functions in C   |   Keywords in C   |   Data Types in C   |   Pointers in C

List of topics: C Programming

No comments:

Post a Comment