c++ - std::wofstream failing to write long long -


i have 2 streams, 1 read , 1 write (diff. files).

std::wofstream origin; std::wifstream attach;  origin.open(m_sourcefile, std::ios_base::app | std::ios_base::binary); attach.open(csattachfilename, std::ios_base::in | std::ios_base::binary); 

appending data file works fine, until gets write operation std::streamoff variable. taking account std::wofstream, output variable "normally" did few times in function.

//[...] origin.seekp(0, std::ios_base::end); //go end std::streamoff noffset = origin.tellp();  //int nfilenamelength = ...; origin.write(reinterpret_cast<wchar_t*>(&nfilenamelength), sizeof(nfilenamelength) / sizeof(wchar_t)); //int //nothing wrong here //[...] write more  attach.close(); auto c1 = origin.bad(); //false origin.write(reinterpret_cast<wchar_t*>(&noffset), sizeof(noffset) / sizeof(wchar_t)); auto c2 = origin.bad(); //true //[...] write more 

what cause issue ?
note works fine if use std::ofstream instead.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -