I am trying to write some simple code with streams but the instruction read hangs. Why ? If you change the definition of Char from char32_t to wchar_t then it works ? ( remember to create the file xxx.txt and write something). Should it be like that ?
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <wchar.h>
#include <locale>
#include <stdlib.h>
#include <uchar.h>
// compilation with -std=c++11
using namespace std;
int main(int argc, char **argv)
{
typedef char32_t Char; // attention at Capital C
// typedef wchar_t Char; // attention at Capital C
typedef basic_ifstream <Char> ifStream; // attention at capital S
ifStream f("xxx.txt", ios::in); // the file exists and contains some text
if(f){
// f.imbue(locale(setlocale(LC_ALL,"")));
Char a[0x100];
f.read(a,14);
f.close();
cout<<"fileClosed"<<endl;
}
return 0;
}