This program shows how to read user data from the keyboard and write the same data to a ascii text file.
The issue to be solved here is what kind of encoding of characters should be used for the output file. C language has library function that support "ascii encoded" text file. Such files have the property that each character in the file requires exactly one byte of storage. In that case the size of the file equals the number of chars in the file. When C language was created these were the only text files available. Today many use Unicode for storage of chars. Then one character in the file will require 2 or 4 bytes of storage.
This sample program demonstrate how to write to a genuine original "ascii file".
Execution: First run the program is in usual way: "sh r.sh" or "./r.sh" without the quotes, of course.
For the second run use the command: "sh r.sh < sample-test-data-unicode.txt", without the quotes.
There are plans for a second program "Text File IO Part 2", which will demonstrate how C programs can read from a text file. It is a matter of time. Your instructor will work on this when time is available. Enjoy your journey toward Systems Programming".