Changing tags from upper case to lower case

I am making a program to determine how many html tags and comments are in a file, the program has to correct any tags that have been entered in upper case ( <P>) and write the contents of the file to a new file, with the tags corrected(<p>). The program cannot modify the first file. Does anyone have any ideas how to make the program change the tags from upper case to lower case? Thanks

Mat
Are you planning on writing the program from the ground up, starting with a main function? You should at least be able to produce an attempt first. Do you know how to open, read, write, and close files at all? I would recommend writing a simple program that opens a file and writes the contents out to a new file, for starters. Then all you have to do is add something that manipulates the data within the program. This website has plenty of examples on filestreams. Try that and let us know when you are stuck. Post an example of your first attempt with specific questions.

Here are some links to algorithms that you might find useful.
http://www.cplusplus.com/reference/algorithm/transform.html

You can use tolower as a predicate function for the transform algorithm once you identify the strings that need to be converted. You could simply read each line of the program into a string and use the string member functions to find the tags and then use transform to make the text lowercase.
Last edited on
So far I have got the program to open the files, check if the file is valid or open, count amount of characters, lines, comments and tags, then copy the contents of the file to another. So I am not starting from scratch. Thanks guys I will take on board what you have suggested

Mat
Topic archived. No new replies allowed.