Assignment 4

Read Das chapter 17 and the notes on Date/Time basics.

  1. Answer the self-test questions at the end of chapter 17.

  2. Do exercise 17.3 two ways - with low-level I/O and high-level I/O routines.

  3. Do exercises 17.4 and 17.5.

  4. Do the following Self-Tests. What were your scores?
    1. Molay, chapter 2 Self-test.
    2. Molay, chapter 3 Self-test.
    3. Molay, chapter 4 Self-test.

  5. Calculate the latest time that can be represented by the time_t data type. After it wraps around, what happens?

  6. Write a program to obtain the current time and print it using strftime, so that it looks like the default output from date (in man section 1). Set the TZ environment variable to different values and see what happens.

  7. The following code works conrrectly on some machines, but not on others. What could be the problem?
    #include <stdio.h>
    
    int main()
    {
        char c;
        while (( c = getchar()) != EOF)
            putchar(c);
    }
    

  8. What does a return value of 0 from printf mean?


Maintained by John Loomis, last updated 18 September 2006