Input/Output Flashcards

1
Q

standard input stream

A

stdin

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

standard output stream

A

stdout

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

standard error stream

A

stderr

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

end of file (type is int)

A

EOF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

get a character

A

getchar()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

print a character

A

putchar(chr )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

print formatted data

A

printf(“format “,arg 1 ,. . . )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

print to string s

A

sprintf(s,”format “,arg 1 ,. . . )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

read formatted data

A

scanf(“format “,&name 1 ,. . . )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

read from string s

A

sscanf(s,”format “,&name 1 ,. . . )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

print string s

A

puts(s)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

declare file pointer

A

FILE *fp;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

pointer to named file

A

fopen(“name”,”mode”)

modes: r (read), w (write), a (append), b (binary)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

get a character

A

getc(fp)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

write a character

A

putc(chr,fp)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

write to file

A

fprintf(fp,”format”,arg1,. . . )

17
Q

read from file

A

fscanf(fp,”format”,arg1,. . . )

18
Q

read and store n elts to *ptr

A

fread(*ptr,eltsize,n,fp)

19
Q

write n elts from *ptr to file

A

fwrite(*ptr,eltsize,n,fp)

20
Q

close file

A

fclose(fp )

21
Q

non-zero if error

A

ferror(fp )

22
Q

non-zero if already reached EOF

A

feof(fp)

23
Q

read line to string s (< max chars)

A

fgets(s, max, fp)

24
Q

write string s

A

fputs(s,fp)

25
Q

h

A

short

26
Q

l

A

long

27
Q

L

A

long double