SpiecsEngine
 
Loading...
Searching...
No Matches

◆ FileLibrary_Read_Line()

bool Spices::FileLibrary::FileLibrary_Read_Line ( const FileHandle * handle,
uint64_t max_length,
char * line_buf,
uint64_t * out_line_length )
static

Read one line from the current file handle pointer, and move pointer the same size.

Parameters
[in]handleThe file handle.
[in]max_lengthDefines the max size per line.
[out]line_bufThe data of one line.
[out]out_line_lengthHow much bytes we read.
Returns
true if file handle is valid and successfully read data.

Definition at line 108 of file FileLibrary.cpp.

109 {
111
112 if (handle->handle && line_buf && out_line_length && max_length > 0)
113 {
114 if (fgets(line_buf, static_cast<int>(max_length), static_cast<FILE*>(handle->handle)) != nullptr)
115 {
116 *out_line_length = strlen(line_buf);
117 return true;
118 }
119 }
120 return false;
121 }
#define SPICES_PROFILE_ZONE

References Spices::FileHandle::handle.

Referenced by SpicesTest::TEST().