CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
file.h
Go to the documentation of this file.
1
3
20
21#pragma once
22
23#include <cx/cx.h>
24
25CX_C_BEGIN
26
29typedef struct FSFile FSFile;
30
43
47typedef enum FSSeekTypeEnum {
48 FS_Set = 0x00010000,
49 FS_Cur = 0x00020000,
50 FS_End = 0x00030000,
52
82_Ret_opt_valid_ FSFile* fsOpen(_In_opt_ strref path, flags_t flags);
83
94bool fsClose(_Pre_valid_ _Post_invalid_ FSFile* file);
95
121bool fsRead(_Inout_ FSFile* file, _Out_writes_bytes_to_(sz, *bytesread) void* buf, size_t sz,
122 _Out_ _Deref_out_range_(0, sz) size_t* bytesread);
123
148bool fsWrite(_Inout_ FSFile* file, _In_reads_bytes_(sz) void* buf, size_t sz,
149 _Out_opt_ _Deref_out_range_(0, sz) size_t* byteswritten);
150
159int64 fsTell(_Inout_ FSFile* file);
160
181int64 fsSeek(_Inout_ FSFile* file, int64 off, FSSeekType seektype);
182
195bool fsFlush(_Inout_ FSFile* file);
196
198
199CX_C_END
struct FSFile FSFile
Definition file.h:29
FSFile * fsOpen(strref path, flags_t flags)
bool fsWrite(FSFile *file, void *buf, size_t sz, size_t *byteswritten)
FSSeekTypeEnum
Definition file.h:47
bool fsRead(FSFile *file, void *buf, size_t sz, size_t *bytesread)
enum FSSeekTypeEnum FSSeekType
int64 fsTell(FSFile *file)
bool fsClose(FSFile *file)
FSOpenFlags
Definition file.h:35
bool fsFlush(FSFile *file)
int64 fsSeek(FSFile *file, int64 off, FSSeekType seektype)
@ FS_Set
Seek from beginning of file (absolute position)
Definition file.h:48
@ FS_End
Seek from end of file (usually negative offset)
Definition file.h:50
@ FS_Cur
Seek from current file position (relative)
Definition file.h:49
@ FS_Write
Open for writing.
Definition file.h:37
@ FS_Lock
Request exclusive access (other processes can read but not write)
Definition file.h:40
@ FS_Create
Create file if it doesn't exist.
Definition file.h:38
@ FS_Overwrite
Create or truncate for writing.
Definition file.h:41
@ FS_Read
Open for reading.
Definition file.h:36
@ FS_Truncate
Truncate file to zero length on open.
Definition file.h:39