SpiecsEngine
 
Loading...
Searching...
No Matches

◆ FileLibrary_Read_all_bytes()

bool Spices::FileLibrary::FileLibrary_Read_all_bytes ( const FileHandle * handle,
char * out_bytes,
uint64_t * out_bytes_read )
static

Read all data form the current file handle pointer.

Parameters
[in]handleThe file handle.
[out]out_bytesThe data that read.
[out]out_bytes_readHow much bytes we read.
Returns
true if file handle is valid and successfully read data.

Definition at line 123 of file FileLibrary.cpp.

124 {
126
127 if (handle->handle && out_bytes && out_bytes_read)
128 {
129 uint64_t size = 0;
130 if (!FileLibrary_Size(handle, &size))
131 {
132 return false;
133 }
134
135 *out_bytes_read = fread(out_bytes, 1, size, static_cast<FILE*>(handle->handle));
136 return *out_bytes_read == size;
137 }
138 return false;
139 }
#define SPICES_PROFILE_ZONE
static bool FileLibrary_Size(const FileHandle *handle, uint64_t *out_size)
Calculate The file size.

References FileLibrary_Size(), and Spices::FileHandle::handle.

Referenced by SpicesTest::TEST().