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
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
#includeint main() { printf("Hello, world "); }
Then the output should be
hello.c hello.c
#includeint main() { printf("Hello, world "); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started