Writing to and reading from same file = crash :(
Hi,
I am running 2 modaless windows. One which is writing to a file
(opened in share mode), the other reading from that file. After
running for a while successfully (about 30 seconds), my program
crashes.
I have a feeling my program is crashing at the part where I'm trying
to read the file.
Basically I am reading line by line from the file, tokenizing each
line (by its tab) and putting each item (3 numbers separated by tab)
into a CArray. Do you see anything wrong with what's below? :
while(src.ReadString(strLine)
{
while(AfxExtractSubString(resToken, strLine, s, _T(' ')))
{
_stscanf( resToken, _T("%f %lf"), &floatnum, &doublenum );
// some logic to put each tokenized items into CArray
}
}
The compiler flags a line from some windows file when it crashed. The
line where it says IAtlStringMgr...etc. Is it related to my code
above or is this telling me the problem is somewhere else?
void Empty() throw()
{
CStringData* pOldData = GetData();
IAtlStringMgr* pStringMgr = pOldData->pStringMgr;
if( pOldData->nDataLength == 0 )
{
return;
}
Thank you