F
felix
This method was written to create new Log File, when the size of the Log File reaches a max size defined by user [10MB in our case]. Here is the code snippet that does this check:
//-- Code starts here : --
static size_t LogSize = 1048576;
bool CreateNewLogs = false;
if ( stat ( logFile, &results ) == 0 )
{
if ( results.st_size > LogSize )
{
CreateNewLogs = true;
}
}
//-- Code ends here : --
It is strange that the condition got satisfied when results.st_size = 2589116.
And we are sure that the size of the data that is written is between 50 to 100 bytes in one operation. And this check is done before writing into the LogFile.
I am not sure if I am missing anything in our understanding of the stat function. Any inputs or pointers on this regard will be really Helpful.
Thanks in advance, and please let me know if any other information is required.
//-- Code starts here : --
static size_t LogSize = 1048576;
bool CreateNewLogs = false;
if ( stat ( logFile, &results ) == 0 )
{
if ( results.st_size > LogSize )
{
CreateNewLogs = true;
}
}
//-- Code ends here : --
It is strange that the condition got satisfied when results.st_size = 2589116.
And we are sure that the size of the data that is written is between 50 to 100 bytes in one operation. And this check is done before writing into the LogFile.
I am not sure if I am missing anything in our understanding of the stat function. Any inputs or pointers on this regard will be really Helpful.
Thanks in advance, and please let me know if any other information is required.