use wstring get line read file
21,015
Try to use std::wifstream
instead of std::ifstream
Author by
simon
Love Code specially c/c++ and big fan Debian. Skype : simon.barotte
Updated on April 16, 2021Comments
-
simon about 3 years
I have a file that contains text, I would like to get each line from this file into a
std::wstring
variable.If I do this I get an error, so is it possible to usestd::wstring
or I'm obligate to use astd::string
? This is my code :std::ifstream fichier( "text.txt" ); if ( fichier ) { std::wstring ligne; while ( std::getline( fichier, ligne ) ) { //work with ligne } }
As mentioned, if I replace
std::wstring
bystd::string
I have no errors.