Node:Questions 16,
Previous:Low-level file routines,
Up:Input and output
Questions
- What are the following?
- File name
- File descriptor
- Stream
- What is a pseudo-device name?
- Where does
stdin
usually get its input?
- Where does
stdout
usually send its output?
- Write a program that simply prints out the following string to the
screen:
6.23e+00
.
- Investigate what happens when you type the wrong conversion
specifier in a program. e.g. try printing an integer with
%f
or a
floating point number with %c
. This is bound to go wrong - but how
will it go wrong?
- What is wrong with the following statements?
printf (x);
printf ("%d");
printf ();
printf ("Number = %d");
Hint: if you don't know, try them in a program!
- What is a whitespace character?
- Write a program that aceepts two integers from the user,
multiplies them together, and prints the answer on your printer.
Try to make the input as safe as possible.
- Write a program that simply echoes all the input to the output.
- Write a program that strips all space characters out of the input and
replaces each string of them with a single newline character.
- The
scanf
function always takes pointer arguments. True or false?
- What is the basic difference between high-level and low-level file routines?
- Write a statement that opens a high level file for reading.
- Write a statement that opens a low level file for writing.
- Write a program that checks for illegal characters in text files. The
only valid characters are ASCII codes 10, 13, and 32..126.
- What statement performs formatted writing to text files?
- Poke around in the header files on your system so you can
see what is defined where.