免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4796 | 回复: 1
打印 上一主题 下一主题

Access violation writing location德问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-10-13 21:29 |只看该作者 |倒序浏览
需要读入一个很大的txt  文件,读到一半时,有Access violation writing location 0x43160036。是否因为内存不够?我看了文本文件,出错的这个数据的地方数字没有任何问题,也不是空的

ifstream inFile;

        inFile.open("D:\\Temp\\myFile.txt";
        if(!inFile.is_open())
        {
                cout<<"Could not open the file"<<endl;
                cout<<"rogram termination.\n";
                exit(EXIT_FAILURE);
        }


        string value;
        int count=0;
                string op[18];
        float oq[18];
        float p1[2];
                float p2[2];
        float p3[2];
                float d12[2];
        float d23[2];
        float dd12;
        float d_ext;
        float cycleLength;
        float next_time;
        float extrapolatedValue;
        float currentJumpLength;
                int i=0;
        int j=0;
        int k=0;
        int l=0;
        int m=0;
        string str1="S11";
        string str2="S22";
        string str3="S33";
        string str4="S12";
        float tmp_reducedTime;
        float itryDataCriterion[2];
        float iDataCriterion[2];
                float reducedTime;
                float over_tolerance_values;
        string iData;
        string instName;
        string iElem;
        string iPoint;
        float current_time;
        float nexttime[10];
                float extrapolated_Value[10];
       

                 while(i<1E100)
                {
                    count=0;
                    while(inFile.good()&&count<1
                        {
                     inFile>>value;
                     op[count]=value;
                     ++count;
                          }
                 
       
                   instName=op[count-18];
                   iElem=op[count-17];
                   iPoint=op[count-16];
                   iData=op[count-15];

                    stringstream aa;
                    aa << op[count-14];
                    aa >> oq[count-14];
                    .
                     .
                    .
            
        
                     i++;
                     if (inFile.eof())
                     break;
                     }
                    inFile.close();

[ 本帖最后由 aphra 于 2008-10-13 22:07 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2008-10-14 08:43 |只看该作者
看上去是写了没有写权限的内存位置

是不是写了字符字面常量?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP