1 Star 0 Fork 5.1K

Almeida / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
utils_file-h.md 13.41 KB
一键复制 编辑 原始数据 按行查看 历史
wenjun 提交于 2020-09-08 10:08 . add OpenHarmony 1.0 baseline

utils_file.h

Overview

Related Modules:

Utils_file

Description:

Performs operations on a file, including to open, close, write, read, and delete a file.

Since:

1.0

Version:

1.0

Summary

Macros

Macro Name and Value

Description

SEEK_SET_FS   0

Defines the offset position used by UtilsFileSeek in a file to start offsetting from the file header.

SEEK_CUR_FS   1

Defines the offset position used by UtilsFileSeek in a file to start offsetting from the current read and write position.

SEEK_END_FS   2

Defines the offset position used by UtilsFileSeek in a file to start offsetting from the end of the file.

O_RDONLY_FS   00

Defines a flag used byUtilsFileOpen to open a file in read-only mode.

O_WRONLY_FS   01

Defines a flag used by UtilsFileOpen to open a file in write-only mode.

O_RDWR_FS   02

Defines a flag used by UtilsFileOpen to open a file in read-and-write mode.

O_CREAT_FS   0100

Defines a flag used by UtilsFileOpen to create a file when the file to open does not exist.

O_EXCL_FS   0200

Defines a flag used by UtilsFileOpen to check whether the file to open exists when O_CREAT_FS is already set.

O_TRUNC_FS   01000

Defines a flag used by UtilsFileOpen to clear the file content if the file exists and can be opened in write mode.

O_APPEND_FS   02000

Defines a flag used by UtilsFileOpen to start reading or writing from the end of a file.

Functions

Function Name

Description

UtilsFileOpen (const char *path, int oflag, int mode)

int 

Opens or creates a file.

UtilsFileClose (int fd)

int 

Closes a file with the specified file descriptor.

UtilsFileRead (int fd, char *buf, unsigned int len)

int 

Reads a specified length of data from a file with the specified file descriptor and writes the data into the buffer.

UtilsFileWrite (int fd, const char *buf, unsigned int len)

int 

Writes a specified length of data into a file with the specified file descriptor.

UtilsFileDelete (const char *path)

int 

Deletes a specified file.

UtilsFileStat (const char *path, unsigned int *fileSize)

int 

Obtains the file size.

UtilsFileSeek (int fd, int offset, unsigned int whence)

int 

Adjusts the read and write position offset in a file.

UtilsFileCopy (const char *src, const char *dest)

int 

Copies the source file to a target file.

UtilsFileMove (const char *src, const char *dest)

int 

Moves the source file into a target file.

1
https://gitee.com/laudrup/docs.git
git@gitee.com:laudrup/docs.git
laudrup
docs
docs
master

搜索帮助