Shortcut for VC ++ to determine whether a file or folder exists _ access, vc_access

Source: Internet
Author: User

Shortcut for VC ++ to determine whether a file or folder exists _ access, vc_access

_ Access function

int _access(    const char *path,    int mode );int _waccess(    const wchar_t *path,    int mode );

Parameters

 
Path

File or directory path.

Mode

Read/write features.

Return Value

If the file contains a specific mode, each function returns 0. If the function returns-1, the name file does not exist or does not have a specific mode. In this case, the following tableErrnoAs shown in.

EACCES

Access Denied: The File Permission setting does not allow the specified access permission.

ENOENT

No file name or path found.

EINVAL

Invalid parameter.

Remarks

 

When using files,_ AccessThe function determines whether the specified file or directory exists and has the specified mode value. In use and directory,_ AccessCheck whether the specified directory exists. Only the read and write permissions for all directories in Windows 2000 and later operating systems are available.

Mode Value

Check the file.

00

Only exist

02

Write-only

04

Read-Only

06

Read and Write

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.