Lecture 14: October 25, 2019

Reading: C text, §11
Due: Homework #2, due October 25, 2019

  1. Greetings and felicitations!
  2. Arrays of strings
    1. int main(int argc, char *argv[]) (same as int main(int argc, char **argv))
    2. Example programs: echo.c, echo2.c
  3. Files
    1. Review files and file pointers — mention file descriptors as underlying mechanism
    2. Standard I/O library (stdio.h)
    3. Standard input, output, error (stdin, stdout, stderr)
    4. Opening, closing files (fopen, fclose)
  4. Reading, writing characters and lines
    1. Reading text data as lines (fgets, gets — do not use this!)
    2. Reading text data as characters (fgetc, getc, getchar, ungetc)
    3. Writing text data as lines (fputs, puts— latter adds a trailing newline)
    4. Writing text data as characters (fputc, putc, putchar)
  5. Reading, writing text data with a fixed format
    1. Reading in text data with a fixed format (fscanf, scanf)
    2. Outputting text data with a fixed format (fprintf, printf)

UC Davis sigil
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email: mabishop@ucdavis.edu
ECS 36A, Programming and Problem Solving
Version of October 30, 2019 at 8:28PM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh