Question: Write a C program called pre. that takes command line arguments that are file names, reads the text from each file, and creates a web

Write a C program called pre. that takes command line arguments that are file names, reads the text from each file, and creates a web page (using html) that displays the file.

HTML is a markup language, meaning that it specifies formatting for text using tags of the form ... with the text to be formatted in between the opening and closing tag. For example, a level one header is written as

This is a Title

.

Your program will read from each input file and write to output files. The output file names will end in .html. If the input file name has an extension, it will be replaced by .html. If it does not, the .html will simply be appended to the name.

HTML files should have some boilerplate at the top. The files you create will have this:

     TITLE   

where TITLE is replaced by the name of the input file. Also < characters and ampersands have special meanings to HTML. < begins tags and ampersands are used to specify special characters. As you write out the contents of the input file, you will replace < with "<" and & with "&". Also, before the text from the input file is written out, you will write out the file name as a level one header. So if the input file hello.c is processed, and it contains

#include  int main() { printf("Hello, world "); } 

Then the output should be

     hello.c   

hello.c

 #include  int main() { printf("Hello, world "); } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!