试图在拷贝文件到一个文件夹里之前判断这个文件夹是否可写,可有什么API可以直接调用的?

解决方案 »

  1.   

    Determine file-access permission.int _access( 
       const char *path, 
       int mode 
    );
    int _waccess( 
       const wchar_t *path, 
       int mode 
    );
    Parameters
    path 
    File or directory path. 
    mode 
    Permission setting. 
    Return Value
    Each function returns 0 if the file has the given mode. The function returns –1 if the named file does not exist or is not accessible in the given mode; in this case, errno is set as follows: EACCES 
    Access denied: file's permission setting does not allow specified access. 
    ENOENT 
    Filename or path not found. 
      

  2.   

    这个函数有点问题,my doucment的路径居然判断为不能写.