我想写个程序,来判断某个文件夹是否存在,请大家帮助我吧,我的email是[email protected],qq是79110201,请大家帮助我1下

解决方案 »

  1.   

    int ValidatePathname(LPCTSTR lpszPathname)
    {
    struct _stat buf;
    int result = _wstat( lpszPathname, &buf );
    if( result == 0 )
    {
    if ( (buf.st_mode & _S_IFDIR) == _S_IFDIR ) 
    {
    // it's folder
    return TYPE_FOLDER;

    else if ( (buf.st_mode & _S_IFREG) == _S_IFREG ) 
    {
    // it's file
    return TYPE_FILE;
    }
    }

    return TYPE_NULL;
    }
      

  2.   

    CreateDirectory就行了,如果存在就返回错误