📄 wyregfile.3wy
字号:
.PP [\fBRet\fP] Pointer of the allocated object, or NULL if failed. User is responsible to \fBdelete\fP the returned object..\"--------------------------------------------.PP.BI "virtual WyRet read(void* " "buf" ", size_t " "count" ", size_t& " "n_read" ")".PP Read at most \fIcount\fP bytes of data from the current r/w position into memory pointed by \fIbuf\fP. \fIn_read\fP is always written with the bytes read and stored into \fIbuf\fP..PP [\fBRet\fP] Ok Succeed. Zero byte read means End-of-file. Wym_EBADF Object is not valid for the operation Wym_EFBIG \fIcount\fP exceeds the maximum Wym_EINTR Interrupted by a signal before any data read Wym_EAGAIN Non-blocking I/O (no data read) Wym_EIO Low level I/O error Wym_EINVAL Device is not suitable for reading Wym_EFAULT \fIbuf\fP is inaccessible Wym_ENOMEM Not enough memory for \fIcount\fP.PP [\fBRefer\fP] ::pread(int,void*,size_t,off_t).\"--------------------------------------------.PP.BI "virtual WyRet read(WyStr&" " buf" ", size_t " "count" ", size_t& " "n_read" ")".PP Read at most \fIcount\fP bytes of data from the current r/w position and \fBappend\fP to \fIbuf\fP. \fIn_read\fP is always written with the bytes read and appended to \fIbuf\fP..PP [\fBRet\fP] Ok Succeed. Zero byte read means End-of-file. Wym_EBADF Object is not valid for the operation Wym_EFBIG \fIcount\fP exceeds the maximum Wym_EINTR Interrupted by a signal before any data read Wym_EAGAIN Non-blocking I/O (no data read) Wym_EIO Low level I/O error Wym_EINVAL Device is not suitable for reading Wym_ENOMEM Not enough memory for \fIcount\fP.PP [\fBRefer\fP] ::pread(int,void*,size_t,off_t).\"--------------------------------------------.PP.BI "virtual WyRet write(const void* " "buf" ", size_t " "count" ", size_t& " "n_written" ")".PP Write data indicated by \fIbuf\fP to the system file from the current r/w position. The number of written bytes is always stored into \fIn_written\fP and added to the current r/w position..PP [\fBRet\fP] Ok Succeed Wym_EBADF Object is not valid for the operation Wym_EINVAL Object attatched device is not suitable Wym_EFAULT \fIbuf\fP is inaccessible Wym_EFBIG Attempt to write beyond the device limit Wym_EAGAIN Non-blocking I/O (write would block) Wym_EINTR Interrupted by a signal before data written Wym_ENOSPC Device left no space for the operation Wym_EIO Low level I/O error.PP [\fBRefer\fP] ::pwrite(int,const void*,size_t,off_t).\"--------------------------------------------.PP.BI "virtual WyRet write(WyCSeg " "buf" ", size_t& " "n_written" ")".PP Write data indicated by \fIbuf\fP to the system file from the current r/w position. The number of written bytes is always stored into \fIn_written\fP and added to the current r/w position..PP [\fBRet\fP] Ok Succeed Wym_EBADF Object is not valid for the operation Wym_EINVAL Object attatched device is not suitable Wym_EFBIG Attempt to write beyond the device limit Wym_EAGAIN Non-blocking I/O (write would block) Wym_EINTR Interrupted by a signal before data written Wym_ENOSPC Device left no space for the operation Wym_EIO Low level I/O error.PP [\fBRefer\fP] ::pwrite(int,const void*,size_t,off_t).\"--------------------------------------------.PP.BI "virtual WyRet write(const WyStr& " "buf" ", size_t& " "n_written" ")".PP Write data indicated by \fIbuf\fP to the system file from the current r/w position. The number of written bytes is always stored into \fIn_written\fP and added to the current r/w position..PP [\fBRet\fP] Ok Succeed Wym_EBADF Object is not valid for the operation Wym_EINVAL Object attatched device is not suitable Wym_EFBIG Attempt to write beyond the device limit Wym_EAGAIN Non-blocking I/O (write would block) Wym_EINTR Interrupted by a signal before data written Wym_ENOSPC Device left no space for the operation Wym_EIO Low level I/O error.PP [\fBRefer\fP] ::pwrite(int,const void*,size_t,off_t).\"--------------------------------------------.PP.BI "virtual WyRet fsync(void)".PP Wait untill all the in-core parts of *this associated file has written to device.PP [\fBRet\fP] Ok Succeed. Wym_EBADF Object is not valid for writting Wym_EIO Low level I/O error Wym_EINVAL Device is not suitable for the operation Wym_EROFS Read-only file system.PP [\fBRefer\fP] ::fsync(int).\"--------------------------------------------.PP.BI "virtual WyRet fdatasync(void)".PP Wait untill the in-core written data has written to device.PP [\fBRet\fP] Ok Succeed. Wym_EBADF Object is not valid for writting Wym_EIO Low level I/O error Wym_EINVAL Device is not suitable for the operation Wym_EROFS Read-only file system.PP [\fBRefer\fP] ::fdatasync(int).\"--------------------------------------------.PP.BI "off_t pos(void) const".PP Get the r/w position that the next r/w operation begins with.PP [\fBRet\fP] The position that the next r/w operation begins with.\"--------------------------------------------.PP.BI "virtual void set_pos(off_t " "ofst" ")".PP Set the next r/w position to begin with \fIofst\fP If *this is default, no effect..\"--------------------------------------------.PP.BI "virtual WyRet seek_end(void)" .PP Seek the r/w position to one more byte farther than where the farest written byte is. So the next pos() call gets the value equivalent to the overall length of the file..PP [\fBRet\fP] Ok Succeed. Wym_EBADF \fIregf\fP is not valid for the operation Wym_ESPIPE Illegal seek.PP [\fBRefer\fP] ::lseek(int,off_t,int).\"--------------------------------------------.PP.BI "virtual WyRet resize(off_t " "length" ")" .PP Resize the file to exactly \fIlength\fP bytes. Note: r/w position of *this is intact..PP [\fBRet\fP] Ok Succeed. Wym_EBADF Object is not valid for the operation Wym_EFBIG Attempt to write beyond the limit Wym_EINTR Interrupted by a signal before data written Wym_EINVAL Device is not suitable for writing Wym_EIO Low level I/O error Wym_EROFS Read-only file system Wym_ETXTBSY Text file busy (see man.).PP [\fBRefer\fP] ::ftruncate(int,size_t).\"--------------------------------------------.PP.BI "virtual WyRet _read_till(void* " "buf" ", size_t " "count" ", size_t& " "n_read" ", char " "c" ")".PP Read at most \fIcount\fP bytes from the file till the read byte is equivalent to \fIc\fP(or End-of-file), store the read bytes into \fIbuf\fP. Member is for convenience defined on read(void*,size_t,size_t&), \fIn_read\fP is always written with the bytes read and stored into \fIbuf\fP. Note: Trailing bytes of stored result in \fIbuf\fP may be modified. Note: Operation takes place from the current r/w position. Failure does not update r/w position Note: This member may be inefficient with frequent use..PP [\fBRet\fP] Ok Succeed Wym_EBADF Object is not valid for the operation Wym_EFBIG \fIcount\fP exceeds the maximum Wym_EINTR Interrupted by a signal Wym_EAGAIN Non-blocking I/O (no data read) Wym_EIO Low level I/O error Wym_EINVAL Device is not suitable for reading Wym_EFAULT \fIbuf\fP is inaccessible Wym_ENOMEM Not enough memory for \fIcount\fP.PP [\fBRefer\fP] ::pread(int,void*,size_t,off_t).\"--------------------------------------------.PP.BI "virtual WyRet _read_till(WyStr& " "buf" ",size_t " "count" ", size_t& " "n_read" ", char " "c" ")".PP Read at most \fIcount\fP bytes from the file till the read byte is equivalent to \fIc\fP(or End-of-file), \fBappend\fP the read bytes into \fIbuf\fP. Member is for convenience defined on read(void*,size_t,size_t&), \fIn_read\fP is always written with the bytes read and appended to \fIbuf\fP. Note: Reallocation of \fIbuf\fP may occur. Note: Operation takes place from the current r/w position. Failure does not update r/w position Note: This member may be inefficient with frequent use..PP [\fBRet\fP] Ok Succeed Wym_EBADF Object is not valid for the operation Wym_EFBIG \fIcount\fP exceeds the maximum Wym_EINTR Interrupted by a signal Wym_EAGAIN Non-blocking I/O (no data read) Wym_EIO Low level I/O error Wym_EINVAL Device is not suitable for reading Wym_ENOMEM Not enough memory for \fIcount\fP.PP [\fBRefer\fP] ::pread(int,void*,size_t,off_t).\"--------------------------------------------.PP.BI "static WyRet create(WyRegFile& " "regf" ",const char* " "pathname" ",int " "f" ", mode_t " "m" ")" .PP.BI "static WyRet create(WyRegFile& " "regf" ",const WyStr& " "pathname" ",int " "f" ", mode_t " "m" ")" .PP Create a system regular file \fIpathname\fP with mode \fIm\fP and reset \fIregf\fP to the state as constructed by WyRegFile(\fIpathname\fP,\fIf\fP) \fIf\fP= flags for ::open \fIm\fP= specifies permissions, the same as ::open(...).PP [\fBRet\fP] Ok Succeed. r/w position is set to zero Wym_EACCES Search permission is denied Wym_ENAMETOOLONG \fIpathname\fP too long Wym_ENOENT \fIpathname\fP does not exist Wym_ENOTDIR Entry in \fIpathname\fP is not a directory Wym_EMFILE Too many open fd Wym_ENFILE File table overflow Wym_ENOMEM Not enough memory Wym_EEXIST Pathname already exists Wym_EINTR Interrupted by a signal Wym_ENOSPC Device left no space for the operation Wym_ENXIO No such device (device not ready) Wym_EROFS Read-only file system Wym_ENODEV No such device Wym_ELOOP Too many symbolic links encountered ... reply converted from the errno from ::open.PP [\fBRefer\fP] ::open(const char*,int,mode_t).\"--------------------------------------------.PP.BI "static WyRet create_tmpfile(WyRegFile& " "regf" ", WyStr& " "name_temp" ")" .PP Create a system regular file of the unique filename formed by appending system generated (six)characters to the argument \fIname_temp\fP, and reset \fIregf\fP to the state as constructed by WyRegFile(\fIname_temp\fP,\fIf\fP), where \fIf\fP and the file mode are system dependent..PP [\fBRet\fP] Ok Succeed. r/w position is set to zero Wym_ENAMETOOLONG \fIname_temp\fP too long Wym_ENOMEM Not enough memory Wym_EEXIST Failed to create an unique filename.PP [\fBRefer\fP] ::mkstemp(char*).\"--------------------------------------------.SH "SEE ALSO".BR wyret.BR wyfilehandle.BR wyfilestat.BR wychrfile.BR wysockfile.BR wymutex.BR wytimespec.SH NOTEExcept added by this library, replys are converted from the errno an underlying C library function returned. Report of such replysare brief from Linux Programmer's Manual. See the associated man pagefor details.Project is in development, http://sourceforge.net/projects/libwx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -