I have written to a binary file using the following
The file looks like what I expect but when I try to read in the file using:Code:m_fpFileOut.open(szFilename,ios::out|ios::binary|ios::app); m_fpFileOut.write((char *) &m_wHeader,sizeof(trUInt16)); m_fpFileOut.write((char *) &m_kDate.m_bDay,sizeof(trUInt8)); m_fpFileOut.write((char *) &m_kDate.m_bMonth,sizeof(trUInt8)); m_fpFileOut.write((char *) &m_kDate.m_wYear,sizeof(trUInt16));
m_wHeader get populated correctly but the others remain at the values that I initialized them with.Code:m_fpCallData.read((char *) &m_wHeader,sizeof(trUInt16)); m_fpCallData.read((char *) &m_kDate.m_bDay,sizeof(trUInt8)); m_fpCallData.read((char *) &m_kDate.m_bMonth,sizeof(trUInt8)); m_fpCallData.read((char *) &m_kDate.m_wYear,sizeof(trUInt16)); printf(">%d<\n",m_wHeader); printf(">%d<\n",m_kDate.m_bDay); printf(">%d<\n",m_kDate.m_bMonth); printf(">%d<\n",m_kDate.m_wYear);
Any ideas ?
Thanks
Goose
[code][/code]tagged by Salem



LinkBack URL
About LinkBacks


