Linux file function-open

Source: Internet
Author: User
Tags function prototype

Linux file function-open an open file

Function Name: Open

Function prototype:

int Open (const char *pathname, int flags) int open (const char *pathname, int flags, mode_t mode)

function function: Open or create a file or device

Owning header file:

#include <sys/types.h>

#include <sys/stat.h>

#include <fcntl.h>

Return value: Successfully returned file descriptor, failed return-1

Parameter description:

Pathname: is the path to open the file/home/hello.c

Flags

-o_rdonly: Read-only Open

-o_wronly: Write-only Open

-o_rdwr: Read and write Open

-o_append: Append

-o_creat: Create a file when the file does not exist, you should use the mode parameter

Mode: is the right to use when using-o_creat to determine which file is created

Linux file function-open

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.