59 lines
1.5 KiB
C
59 lines
1.5 KiB
C
#ifndef INCLUDED_C_FILE_H
|
|||
|
|
#define INCLUDED_C_FILE_H
|
||
|
|
|
||
|
|
#ifndef INCLUDED_C_TYPES_H
|
||
|
|
#include <c_Types.h>
|
||
|
|
#endif /*INCLUDED_C_TYPES_H*/
|
||
|
|
|
||
|
|
#ifndef INCLUDED_STDIO_H
|
||
|
|
#define INCLUDED_STDIO_H
|
||
|
|
#include <stdio.h>
|
||
|
|
#endif /*INCLUDED_STDIO_H*/
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/* ------------------------------------------------------------------------------------------------------------------ */
|
||
|
|
/* */
|
||
|
|
|
||
|
|
|
||
|
|
typedef struct {
|
||
|
|
FILE* fp;
|
||
|
|
}c_File_t;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/* ------------------------------------------------------------------------------------------------------------------ */
|
||
|
|
/* */
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/* ------------------------------------------------------------------------------------------------------------------ */
|
||
|
|
/* */
|
||
|
|
|
||
|
|
c_err_t c_File_Open(c_File_t* file, const char* fileName, const char* mode);
|
||
|
|
|
||
|
|
void c_File_Close(c_File_t* file);
|
||
|
|
|
||
|
|
c_err_t c_File_Read(c_File_t* file, void* buffer, c_size_t buffer_size, c_size_t *read_size);
|
||
|
|
|
||
|
|
c_err_t c_File_Readline(c_File_t* file, void* buffer, c_size_t buffer_size, c_size_t *read_size);
|
||
|
|
|
||
|
|
c_err_t c_File_Write(c_File_t* file, void* buffer, c_size_t buffer_size, c_size_t *write_size);
|
||
|
|
|
||
|
|
long long c_File_Size(c_File_t* file);
|
||
|
|
|
||
|
|
c_err_t c_File_Flush(c_File_t* file);
|
||
|
|
|
||
|
|
c_err_t c_File_Seek(c_File_t* file, long long position);
|
||
|
|
|
||
|
|
c_err_t c_File_MkDirs(const char* path);
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief 检查指定路径的文件或目录是否存在
|
||
|
|
* @param fileName 文件的绝对路径或相对路径
|
||
|
|
* @return 存在返回 C_TRUE,不存在或无权限返回 C_FALSE
|
||
|
|
*/
|
||
|
|
c_bool_t c_File_IsExist(const char* fileName);
|
||
|
|
|
||
|
|
#endif /*INCLUDED_C_FILE_H*/
|