11.11. Homework 11 - No Tabs

In a string, the tab character is ‘\t’ – ASCI character 9. The intent of tabs is to line text up with consistent indenting. Text editors often allow the user to specify the number of space characters that a tab should fill. Line printers often default to 8 characters for tabs, yet 4 characters per indention level is more common for source code or other text files. If tabs are set to be every 4 characters, then the next character should be displayed at the column that is an interger multiple of 4. So if a line consists of 13 characters, a tab and then more characters, then the second set of characters should begin at column position 16, so in this case, the tab should fill 2 character positions.

Write a C program to read a text file and replace any tab characters with the appropriate number of spaces (ASCII character 32) to line up the text at 4 spaces per indention level. The program may prompt the user to enter the names of the input and output files. Use the fgetc() function to read the file and fputc() to write the data.