📄 subject_35212.htm
字号:
<p>
序号:35212 发表者:cdyw 发表日期:2003-04-04 17:47:18
<br>主题:VC中用MFC怎样正确读出TC下用一个记录文件(数据结构是一结构体)中数据
<br>内容:在TC下用一个结构体(<BR>struct VQC_DATA_TYPE<BR>{<BR> unsigned char name; //1Byte<BR> unsigned char info; //1Byte<BR> unsigned char torq; //1Byte<BR> struct date NowDate; //4Byte<BR> struct time NowTime; //4Byte<BR> float f220_1muab; //4Byte<BR> float f220_1mubc; //4Byte<BR> float f220_1muca; //4Byte<BR> float f220_2muab; //4Byte<BR> float f220_2mubc; //4Byte<BR> float f220_2muca; //4Byte<BR> float f220_3muab; //4Byte<BR> float f220_3mubc; //4Byte<BR> float f220_3muca; //4Byte<BR> float f1q; //4Byte<BR> float f2q; //4Byte<BR>}<BR>生成的数据文件,在VC下用CFile类不能正确按顺序读出,我试了以下用CFile类<BR>按这个结构写一个文件,结果有56个字节,它多插入了一个字节。TC下是55个字节。实际这个<BR>结构只占55字节。但VC好象为了分隔结构体中不同类型变量,多插入了字符。<BR> 我怎样才能在VC 真确读出这个文件中的数值呢?(TC中的int(2Byte),在 VC中用的short(2byte))
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:擎天柱 回复日期:2003-04-04 19:22:20
<br>内容:在vc的菜单中修改Project->Setting->C/C++->Category->Code Generation->Struct member alignment 8Bytes为1Bytes即可。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -