file utility More...
#include "ZFFile_fwd.h"
Go to the source code of this file.
Functions | |
zfbool | ZFFileIsExist (const zfchar *path) |
return true if file specified by path is exist | |
zfbool | ZFFileIsDir (const zfchar *path) |
return true if file specified by path is a directory | |
zfbool | ZFPathCreate (const zfchar *path, zfbool autoMakeParent=(_ZFT_t_zftrue)) |
make directory | |
zfbool | ZFFileCopy (const zfchar *srcPath, const zfchar *dstPath, zfbool isRecursive=(_ZFT_t_zftrue), zfbool isForce=(_ZFT_t_zftrue)) |
copy a file or directory from srcPath to dstPath | |
zfbool | ZFFileMove (const zfchar *srcPath, const zfchar *dstPath, zfbool isForce=(_ZFT_t_zftrue)) |
move a file or directory from srcPath to dstPath | |
zfbool | ZFFileRemove (const zfchar *path, zfbool isRecursive=(_ZFT_t_zftrue), zfbool isForce=(_ZFT_t_zftrue)) |
delete a file or directory from srcPath to dstPath | |
zfbool | ZFFileFindFirst (ZFFileFindData &fd, const zfchar *path) |
find file or directory, similar to FindFirstFile under Windows | |
zfbool | ZFFileFindNext (ZFFileFindData &fd) |
void | ZFFileFindClose (ZFFileFindData &fd) |
void * | ZFFileOpen (const zfchar *filePath, ZFFileOpenOptionFlags flag=(v_ZFFileOpenOption::e_Read), zfbool autoCreateParent=(_ZFT_t_zftrue)) |
open a file for read or write | |
zfbool | ZFFileClose (void *token) |
close and save the file if need, return false if save failed | |
zfindex | ZFFileTell (void *token) |
get current file's position or zfindexMax() if error | |
zfbool | ZFFileSeek (void *token, zfindex byteSize, ZFSeekPos position=(ZFSeekPosBegin)) |
similar to fseek, return false if seek out of range | |
zfindex | ZFFileRead (void *token, void *buf, zfindex maxByteSize) |
read file | |
zfindex | ZFFileWrite (void *token, const void *src, zfindex maxByteSize=(((zfindex) -1))) |
write file, see ZFFileRead | |
void | ZFFileFlush (void *token) |
flush the file, useful only for files opened for write | |
zfbool | ZFFileIsEof (void *token) |
see ZFFileRead | |
zfbool | ZFFileIsError (void *token) |
see ZFFileRead | |
zfindex | ZFFileSize (void *token) |
util method to get file's total size (not left size) | |
file utility
return true if file specified by path is exist
return true if file specified by path is a directory
make directory
|
extern |
copy a file or directory from srcPath to dstPath
if both src and dst exist, but one is file and another is dir, return zffalse
merge directory if dst is an existing dir (if isForce not set, would return false if dst has a child file with the same path in src)
override file if dst is an existing file and isForce is zftrue
|
extern |
move a file or directory from srcPath to dstPath
|
extern |
delete a file or directory from srcPath to dstPath
fail if isRecursive is zffalse and dst is a dir
|
extern |
find file or directory, similar to FindFirstFile under Windows
path supports path only, without wildcard support, e.g. "/path/" or "/path", "." and ".." won't be included
typical usage:
|
extern |
|
extern |
|
extern |
open a file for read or write
read file
return size read, even if error occurred (whether error occurred or eof, could be accessed by ZFFileIsError and ZFFileIsEof)
typical usage:
note that the tail '\0' won't be written to buf
|
extern |
write file, see ZFFileRead
return size written, even if error occurred (whether error occurred or not, could be accessed by ZFFileIsError)
typical usage:
maxByteSize could be zfindexMax(), which means ZFFileWrite should be stopped when reached 0x00 in src, usually to output a UTF8 string
|
extern |
util method to get file's total size (not left size)
ZFFileSeek to end, ZFFileTell, then ZFFileSeek to restore, return zfindexMax() if error
note that result is not ensured if file is opened in append mode