#include <vfs.h>
Public Member Functions | |
| File () | |
| Construct file object and open the file. You won't usually call constructor on your own: File objects are created using "object factory" methods of FileSystem objects like OpenFileRead() or CreateFile(). | |
| virtual | ~File () |
| Destroy file object and close the file. | |
| virtual int | read (void *buf, int count)=0 |
| Read specified amount of bytes from file into user-specified buffer. Internal file pointer is updated. If you try to read past end of file - will read only the remainder of the file, and returned value will be less than requested count. buf - User specified buffer count - count of bytes to read. | |
| virtual int | write (void *buf, int count)=0 |
| Write specified amount of bytes from user-specified buffer to file. Internal file pointer is updated. If you try to write past end of file - will try to expand the file. Sometimes it's not possible (out of disk space, or other limitations of the file system that this file is bound to). Exception will be thrown in these cases. buf - User specified buffer count - count of bytes to read. | |
| virtual long | seek (long offset)=0 |
| Attempt to seek in file. Seek offset is always defined as absolute from beginning of file. | |
| virtual long | get_pos ()=0 |
| Retrieve current file pointer offset from start of file. The offset is counted in bytes. | |
| virtual long | get_size ()=0 |
| Retrieve current file size in bytes. | |
| int | safe_read (void *buf, int count) |
| Exactly the same as read(), but in case of attempt to read past end of file will throw exception. | |
| int | safe_write (void *buf, int count) |
| Exactly the same as write(), but in case write() could not complete (written less than requested) - will throw an exception. | |
|
|
Construct file object and open the file. You won't usually call constructor on your own: File objects are created using "object factory" methods of FileSystem objects like OpenFileRead() or CreateFile().
|
|
|
Destroy file object and close the file.
|
|
||||||||||||
|
Read specified amount of bytes from file into user-specified buffer. Internal file pointer is updated. If you try to read past end of file - will read only the remainder of the file, and returned value will be less than requested count. buf - User specified buffer count - count of bytes to read.
|
|
||||||||||||
|
Write specified amount of bytes from user-specified buffer to file. Internal file pointer is updated. If you try to write past end of file - will try to expand the file. Sometimes it's not possible (out of disk space, or other limitations of the file system that this file is bound to). Exception will be thrown in these cases. buf - User specified buffer count - count of bytes to read.
|
|
|
Attempt to seek in file. Seek offset is always defined as absolute from beginning of file.
|
|
|
Retrieve current file pointer offset from start of file. The offset is counted in bytes.
|
|
|
Retrieve current file size in bytes.
|
|
||||||||||||
|
Exactly the same as read(), but in case of attempt to read past end of file will throw exception.
|
|
||||||||||||
|
Exactly the same as write(), but in case write() could not complete (written less than requested) - will throw an exception.
|
1.3.6