1

I am loading text like this:

wstring file;
wchar_t *data = new wchar_t[file_size+1];
fread(data, sizeof(wchar_t), file_size+1, file_stream);
file = data; // I want to create the wstring from the wchar_t data
wcout << data.size() << " " << file;

I have 2 problems with this:

  1. If I run the program in the Borland C++ Builder, it crashes at wcout (error: "std::bad_alloc") and MVSExpress 2015 doesn't display the string
  2. In Borland, the data.size() returns 2203 whereas MVSExpress 2015 shows 4406

0 Answers0