Review


Know the Concepts

  • Describe the lifecycle of a file descriptor.

  • What are the standard file descriptors and what are they used for?

  • What is a buffer?

  • What is the difference between the .data section and the .bss section?

  • What are the system calls related to reading and writing files?

Use the Concepts

  • Modify the toupper program so that it reads from STDIN and writes to STDOUT instead of using the files on the command-line.

  • Change the size of the buffer.

  • Rewrite the program so that it uses storage in the .bss section rather than the stack to store the file descriptors.

  • Write a program that will create a file called heynow.txt and write the words "Hey diddle diddle!" into it.

Going Further

  • What difference does the size of the buffer make?

  • What error results can be returned by each of these system calls?

  • Make the program able to either operate on command-line arguments or use STDIN or STDOUT based on the number of command-line arguments specified by ARGC.

  • Modify the program so that it checks the results of each system call, and prints out an error message to STDOUT when it occurs.




Programming from the Ground Up
Programming from the Ground Up
ISBN: 0975283847
EAN: 2147483647
Year: 2006
Pages: 137

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net