/* Program Name: HTML Converter Process: ??? Function Input/Parameters: ??? Function Output/Parameters: ??? Function Output/Returned: ??? Device Input/Device: ??? Device Output/Monitor: ??? Dependencies: ??? */ #include #include #include #include #include #include #include #include #include #include using namespace std; // class definitions // function prototypes // main program int main(int argc, char **argv) { string fileName; filesystem::path filePath; ifstream inputFile; ofstream outputFile; char currentChar; // menu for user cout << "CPP to HTML Converter" << endl; // ask the user for a cpp file. (check to see if valid?) cout << "Please enter a CPP source file: "; cin >> fileName; // check if the file has the .cpp extension filePath = fileName; if(filePath.extension() != ".cpp" && filePath.extension() != ".cp" && filePath.extension() != ".C" && filePath.extension() != ".cc") { cout << "Invalid File, please enter something else and try again." << endl; return -1; } // check if the file exists if(!filesystem::exists(fileName)) { cout << "File is valid, but does not exist." << endl; return -1; } // the file exists, start the parsing according to the comment below. inputFile.open(fileName); outputFile.open(filePath.replace_extension(".html")); // add the
 tag, read each character, check to see if the character is one that needs to be
    // modified, like '<' and '>' and turned into '<' and '>' once at the end of input file,
    // add the 
tag, and output to a new html file that uses the file name // and rids itself of everything after the dot and replaces it with '.html' and writes it out. // add the '
' tag to the output file
    outputFile << "
" << endl;
    // read in the characters one at a time, check if the character is a '<' or a '>' and replace.
    currentChar = inputFile.get();
    // outputFile << (char)inputFile.get();
    while(!inputFile.eof())
    {
        if(currentChar == '<' || currentChar == '>')
        {
            if(currentChar == '<')
            {
                outputFile << "<";
            }
            else
            {
                outputFile << ">";
            }
        }
        else
        {
            outputFile << currentChar;
        }
        currentChar = inputFile.get();
        // outputFile << (char)inputFile.get();
    }
    // add the '
tag to the output file outputFile << "
"; // close the input and output files inputFile.close(); outputFile.close(); // return 0 return 0; }