读书人

用那个API判断资料是否存在

发布时间: 2012-09-24 13:49:42 作者: rapoo

用那个API判断文件是否存在?
有很多方法,但一般那个方法最方便?具体代码实现是怎样。

[解决办法]

C/C++ code
    char *name = "C:\\Users\\administrator\\Desktop\\temp";    FILE *f = NULL;    try    {        f = fopen(name,"r");        if (f==NULL)        {            cout<<"not file"<<endl;        }        else        {            cout<<"is file"<<endl;            fclose(f);        }    }        catch (CException* e)    {                cout<<"exception"<<endl;    } 

读书人网 >C++

热点推荐