10 Flashcards
What is the function prototype for getchar?
int getchar(void);
What does getchar do?
Gets a single character from stdin.
What is the function prototype for putchar?
int putchar(int c);
What does putchar do?
Prints a single character to stdout.
What does putchar do if it is not given an unsigned char?
It returns an error value.
What does getchar return when it reaches the end of input?
EOF. This is a macro and may vary across platforms.
What is the return value of fopen?
FILE*
What are the three modes of file access?
‘r’, ‘w’, ‘a’
What is the ‘r’ mode of file access used for?
Reading.
What is the ‘w’ mode of file access used for?
Writing.
What is the ‘a’ mode of file access used for?
Appending data to a file.
What is the difference between ‘write’ and ‘append’ mode?
Write deletes the contents of the file if it already exists, whereas append starts writing to the end of the file.
What function is used to close a FILE*?
fclose
What is the function prototype for fclose?
int fclose(FILE *fp);
What is the function prototype for fopen?
FILE* fopen(const char* fname, const char* mode);