Working with strings
This is a wiki page. Be bold and improve it!
If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.
Use std::string.
Beware: a string literal (e.g. "Hello World") is NOT a std::string but a const *char.
Most std functions and classes do not take a std::string as an argument, but a *char.
E.g.:
ifstream inf("file.txt"); // Ok, because "file.txt" is a *char.
std::string file = "file.txt";
ifstream inf(file); // Fail, because file is not a *char but a std::string.
// Solution:
ifstream inf(file.to_c); // Ok.
std::string is actually an object that has a .to_c member that casts the string to a *char.