c++ - basic_ofstream<unsigned char> in gcc fails -


i have listed below working code

ofstream of("/home/joe/test.dat", ios::out | ios::binary); of.write((char*)&dat[0],dat.size()); 

but code below produces no output

basic_ofstream<unsigned char> of("/home/joe/test.dat", ios::out | ios::binary); of.write(&dat[0],dat.size()); 

i tried gcc 4.9 on linux. note there no compilation warning or error.

this not working:

basic_ofstream<unsigned char> of("/tmp/test2.dat", ios::out | ios::binary); of.write(&dat[0],dat.size());   

but working:

basic_ofstream<char> of("/tmp/test3.dat", ios::out | ios::binary);  of.write((char*)&dat[0],dat.size());   

the implementation under no obligation supply instantiation of std::char_traits<unsigned char>, , have incompatible instantiations. might work particular compiler, it's not required.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -