how to create/open/save a file as UTF-8 encoding in c++ using ofstream

  • Thread starter Thread starter Midhun jaya
  • Start date Start date
M

Midhun jaya

Guest
Hi,

Our report should contains only ANSI strings.. but encoding should be 'UTF-8'.

i am using visual studio 2013 (win32) and my code is,

std::ofstream of;

of.open("d:/abcdef.txt", std::ios::out | std::ios::app);


std::locale utf8_locale(std::locale(), new utf8cvt<false>);

of.imbue(utf8_locale);


of << "my sample strings";


of.close();

with this code i have compilation error on locale (no instance of constructor matches the argument list.

argument types are: (std::locale, <error-type>))

anyone please help me

regards,

Midhun

Continue reading...
 
Back
Top