wanghello 发表于 2007-11-9 16:02:00

求助:未处理的异常c0000005

<p>&nbsp;typedef struct DataField_String<br/>&nbsp;{<br/>&nbsp;&nbsp;char *FieldName;<br/>&nbsp;&nbsp;char *FieldVal;<br/>&nbsp;&nbsp;<br/>&nbsp;};<br/>&nbsp;typedef struct DataField_Double<br/>&nbsp;{<br/>&nbsp;&nbsp;char *FieldName;<br/>&nbsp;&nbsp;DOUBLE FieldVal;<br/>&nbsp;&nbsp;<br/>&nbsp;};<br/>&nbsp;typedef struct DataField_long<br/>&nbsp;{<br/>&nbsp;&nbsp;char *FieldName;<br/>&nbsp;&nbsp;long FieldVal;<br/>&nbsp;&nbsp;<br/>&nbsp;};<br/>&nbsp;typedef struct PipeExtentionData<br/>&nbsp;{<br/>&nbsp;&nbsp;DataField_String PipeType;<br/>&nbsp;&nbsp;DataField_String DN;<br/>&nbsp;&nbsp;DataField_Double D;<br/>&nbsp;&nbsp;DataField_Double b;<br/>&nbsp;&nbsp;DataField_Double High;<br/>&nbsp;&nbsp;DataField_Double Length;<br/>&nbsp;&nbsp;DataField_long Index;<br/>&nbsp;&nbsp;<br/>&nbsp;};<br/>&nbsp;<br/>&nbsp;//数据初始化<br/>&nbsp;PipeExtentionData PipeData=<br/>&nbsp;{<br/>&nbsp;&nbsp;{"管道类型","焊接钢管"},<br/>&nbsp;&nbsp;{"公称直径","DN20"},<br/>&nbsp;&nbsp;{"管道外径",0.0},<br/>&nbsp;&nbsp;{"管道壁厚",0.0},<br/>&nbsp;&nbsp;{"管道标高",0.0},<br/>&nbsp;&nbsp;{"管段长度",0.0},<br/>&nbsp;&nbsp;{"管段编号",1}<br/>&nbsp;};<br/>&nbsp;<br/>&nbsp;acedGetString(0,"\n管道类型:",PipeData.PipeType.FieldVal);<br/>&nbsp;acutPrintf("\n管道类型:%S",PipeData.PipeType.FieldVal);<br/></p><p></p><p>以上代码编译通过,运行时输入后出错,错误提示:“未处理的异常c0000005(Access Violation Writing 0x182b174),地址:77C17AD8h”</p><p>请高手指教该如何解决,谢谢!!!</p>

wanghello 发表于 2007-11-10 08:50:00

<p>以上代码简化为如下代码,编译通过,错误依旧</p><p>&nbsp;char *abc;<br/>&nbsp;acedGetString(0,"\n管道类型:",abc);<br/></p>

fpiw 发表于 2007-11-10 11:11:00

char abc="";<br/>acedGetString(0,"\n管道类型:",abc);

fpiw 发表于 2007-11-10 11:14:00

acedGetString()需要一个分配过内存初始化过的char*,函数内部不负责分配内存,而是直接赋值,给一个未经初始化的无效指针赋值,当然会出错了<br/><br/>

wanghello 发表于 2007-11-13 15:27:00

问题解决谢谢高手指点
页: [1]
查看完整版本: 求助:未处理的异常c0000005