Adding text files in Clion

Need help adding text files in Clion? or to create them to then write some data? I am trying to add some text files to a program I am working on in order to test my code.
your question is ambiguous
Need help adding text files in Clion?

Nope.
Thanks for asking, though!
XDDDDD
Need help adding text files in Clion?

But I might need some help using files with Dtiger.

Oh, wait, no, I don't.
I am trying to add some text files to a program

If you have a program like this:
1
2
3
4
5
#include <iostream>
int main()
{
    std::cout << "Hello world\n";
}

and a text file like this:
apple: caramel, ginger, cinnamon, cloves, nutmeg
orange: dirt, turd
coffee: cinnamon, nutmeg
ice cream: caramel, coffee

You can add the text file to the program like so:
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>

const char *textFile = "apple: caramel, ginger, cinnamon, cloves, nutmeg\n"
    "orange: dirt, turd\n"
    "coffee: cinnamon, nutmeg\n"
    "ice cream: caramel, coffee";

int main()
{
    std::cout << "Hello world\n";
}


...

Now I know that isn't what you wanted. But it's perfectly valid answer to the question you asked. So please be more specific about what you need to do. Need to read a file? Okay, we can show you how to read it line by line. But is that what you're really asking? Or do you need to know how to do something with the file that you read?

If this is an assignment, please post the assignment. We can help much better when we know exactly what you're trying to do.
Topic archived. No new replies allowed.