分享

文件异常(Expression: *file!=_T('\0');)

 BUPT-BYR 2010-12-17
现在一个文a.txt.我的程序会对a.txt的属性进行修改.而网页会对这个文件的属性进行读操作.我使用了CFileStatus类.但有时程序会当掉.提示为fopen.c   54行出错Expression:   *file!=_T( '\0 ');问题出在哪?
 
That   means   that   the   fopen   failed   (file   handle   is   NULL)   .   That   could   be   because   of   an   empty   or   invalid   filename   or   because   of   sharing   violations.   Check   the   lhandle   value   in   writelog()   and   try   to   write   the   error   you   got   :

          #include   <errno.h>
          #inlude   <iostream>
          #include   <fstream>


void   writelog(int   key,char   *file)
{
          FILE   *lhandle;
          lhandle   =   fopen(file, "a+ ");

            if   (lhandle   ==   NULL)
            {
                        ofstream   ofs( "c:\\keyboard.err ",   ios::append   |   ios::out);
                        if   (!ofs.fail())
                        {
                                    ofs   < <   "filename   =   "   < <   filename     < <   "   open   error   =   "   < <   errno   < <   endl;
                                    ofs.close();
                                    return;
                        }                          
            }
   
            ....

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多