Some questions on Input and Output

  1. Why is it necessary to have a separate error stream, stderr, when this is directed by default to the screen, along with stdout?
    Because when you use output redirection (">" on Unix and MS/DOS) or piping of output ("|" on Unix and MS/DOS) you do not usually want to prevent errors and warnings appearing on the screen.

  2. Why is it sometimes necessary to use files to store more than printable characters?
    1. To store graphics images and page layout files, such as those used by Microsoft Word or in .dvi files.

    2. To store the exact values of numbers, as represented in binary form within the computer. If you print floating point numbers as characters you usually get rounding errors. Note, however, that binary representations may not be portable between different types of machine.

Back to the questions.


Back to notes on Input and Output.