Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use wstring get line read file

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 use std::wstring or I'm obligate to use a std::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 by std::string I have no errors.

like image 522
simon Avatar asked Nov 19 '15 14:11

simon


1 Answers

Try to use std::wifstream instead of std::ifstream

like image 199
Yuriy Orlov Avatar answered Sep 21 '22 08:09

Yuriy Orlov