SLIDE 1
1
Files in C
cp1h James Soutter
Overview
- Character oriented I/O (revision)
- Files and streams
- Opening and closing files
Overview Character oriented I/O (revision) Files in C Files and - - PDF document
Overview Character oriented I/O (revision) Files in C Files and streams Opening and closing files cp1h James Soutter Idiom for character-oriented I/O int c; Character oriented I/O while ((c = getchar()) != EOF) { /* Code for
stdin is read by getchar() stdout is written to by putchar(c) stderr is a second output stream
These streams are defined in stdio.h
fprintf(stdout, “Hello”) ≡ printf(“Hello”). putc(c, stdout) ≡ putchar(c) getc(stdin) ≡ getchar()
stdin stdout stderr