K
KeanHeng
Guest
Guys... need help here to figure how to resolve
THere is a portion of records missing at line 20000+ of 7MB text file during high-speed writing.
With Mutex Lock
on writing to 3 files in For Loop and with high-speed queue calling write simultaneously (milliseconds request)
Therefore decided to make the file fOpen-only one-time, instead of everytime fopen/fclose
but having weird character problem? how to flush?
typedef _iobuf
FILE * fp = fopen(FileName, "a+");
// current solution
m_MutexWriteFile.Lock();
For Loop
{
/*
// high speed calling write with mutex, causing a portion records missing
switch case:
{
case 1:
fopen(FileName, "a+");
case 2:
fopen(FileName, "a+");
case 3:
fopen(FileName, "a+");
}
*/
Íyy (<--Weird character print out each line)
Íyy (<--Weird character print out each line)
Íyy (<--Weird character print out each line)
fprintf(fp, ",%-14s", "TIMESTAMP");
// fclose(FileName); // without fclose
}
m_MutexWriteFile.Unlock();
Continue reading...
THere is a portion of records missing at line 20000+ of 7MB text file during high-speed writing.
With Mutex Lock
on writing to 3 files in For Loop and with high-speed queue calling write simultaneously (milliseconds request)
Therefore decided to make the file fOpen-only one-time, instead of everytime fopen/fclose
but having weird character problem? how to flush?
typedef _iobuf
FILE * fp = fopen(FileName, "a+");
// current solution
m_MutexWriteFile.Lock();
For Loop
{
/*
// high speed calling write with mutex, causing a portion records missing
switch case:
{
case 1:
fopen(FileName, "a+");
case 2:
fopen(FileName, "a+");
case 3:
fopen(FileName, "a+");
}
*/
Íyy (<--Weird character print out each line)
Íyy (<--Weird character print out each line)
Íyy (<--Weird character print out each line)
fprintf(fp, ",%-14s", "TIMESTAMP");
// fclose(FileName); // without fclose
}
m_MutexWriteFile.Unlock();
Continue reading...