Input/Output Flashcards
1
Q
standard input stream
A
stdin
2
Q
standard output stream
A
stdout
3
Q
standard error stream
A
stderr
4
Q
end of file (type is int)
A
EOF
5
Q
get a character
A
getchar()
6
Q
print a character
A
putchar(chr )
7
Q
print formatted data
A
printf(“format “,arg 1 ,. . . )
8
Q
print to string s
A
sprintf(s,”format “,arg 1 ,. . . )
9
Q
read formatted data
A
scanf(“format “,&name 1 ,. . . )
10
Q
read from string s
A
sscanf(s,”format “,&name 1 ,. . . )
11
Q
print string s
A
puts(s)
12
Q
declare file pointer
A
FILE *fp;
13
Q
pointer to named file
A
fopen(“name”,”mode”)
modes: r (read), w (write), a (append), b (binary)
14
Q
get a character
A
getc(fp)
15
Q
write a character
A
putc(chr,fp)