Jump to content

Wikipedia:Sandbox/Archive: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
No edit summary
Line 2: Line 2:
<!-- Hello! Feel free to try your formatting and editing skills below this line. As this page is for editing experiments, this page will automatically be cleaned every 12 hours. -->'''
<!-- Hello! Feel free to try your formatting and editing skills below this line. As this page is for editing experiments, this page will automatically be cleaned every 12 hours. -->'''


{{humor}}


== Member functions ==
== Member functions ==

Revision as of 17:22, 12 September 2007

Member functions

Functions declared in stdio.h can generally be divided into two categories: the functions for file manipulation and the functions for input-output manipulation.

Name Notes
File manipulation functions
fclose closes a file associated with the FILE * value passed to it
fopen, freopen, fdopen opens a file for certain types of reading or writing
remove removes a file (deletes it)
rename renames a file
rewind acts as if fseek(stream, 0L, SEEK_SET) was called for the stream passed, and then its error indicator cleared
tmpfile creates and open a temporary file, which is deleted when closed with fclose()
Input-output manipulation functions
clearerr clears end-of-file and error indicators for a given stream
feof checks whether an end-of-file indicator has been set for a given stream
ferror checks whether an error indicator has been set for a given stream
fflush forces any pending buffered output to be written to the file associated with a given stream
fgetpos stores the file position indicator of the stream associated by its first argument (a FILE *) to its second argument (a fpos_t *)
fgetc returns one character from a file
fgets gets a string from the file (ends at newline or null character)
fputc writes one character to a file
fputs writes a string to a file
ftell returns a file-position indicator which can then be passed to fseek
fseek seeks through a file
fsetpos sets the file position indicator of a stream associated by its first argument (a FILE *) as stored in its second argument (a fpos_t *)
fread reads different sized data from a file
fwrite writes different sized data to a file
getc reads and returns a character from a given stream and advances the file position indicator; it is allowed to be a macro with the same effects as fgetc, except that it may evaluate the stream more than once
getchar has the same effects as getc(stdin)
gets reads characters from stdin until a newline is encountered and stores them in its only argument
printf, fprintf,vprintf used to print to stdout
sprintf, snprintf also used to print to a string
perror writes an error message to stderr
putc writes and returns a character to a stream and advances the file position indicator for it; it is allowed to be a macro with the same effects as fputc, except that it may evaluate the stream more than once
putchar, fputchar has the same effects as putc(stdout)
scanf, fscanf, sscanf used to input from stdin
vfscanf, vscanf, vsscanf also used to input from stdin
setbuf
setvbuf sets the buffering mode for a given stream
tmpnam creates a temporary filename and stores it in its first argument (a char *)
ungetc pushes a character back onto a stream
puts outputs a character string to stdout

test123