Day 15/100 100 Days of Code

Photo by Ilya Pavlov on Unsplash

Day 15/100 100 Days of Code

Info hunter

We have reached day 15! Today, I added the code to write the paragraphs containing keywords to a text file. Currently, the text file is emptied before each operation.

std::ofstream contentFile;
    contentFile.open("../content/content.txt");

    if (!contentFile.is_open())
    {
        std::cout << "Failed to open file" << std::endl;
        std::cout << std::strerror(errno) << std::endl;
        exit(errno);
    }

    contentFile << input << std::endl;

            if (keywordsFound)
            {
                contentFile << toString << std::endl;
                keywordsFound = false;
            }