Board index » cppbuilder » FindFirst gives excption error
Newsreader
CBuilder Developer |
FindFirst gives excption error2004-10-26 01:38:47 PM cppbuilder15 Hi, I have to following code: TSearchRec srec; TListItem *litem; int result; result = FindFirst("D:\\test\\*.dat", faAnyFile, srec); //<-this is the line that //generates the exception while(result == 0) { litem = ListView1->Items->Add(); litem->Caption = srec.Name; litem->SubItems[0].Add(ExtractFileExt(srec.Name)); litem->SubItems[1].Add(srec.Size); litem->SubItems[2].Add(srec.Time); result = FindNext(srec); } FindClose(srec); I have populate the D:\test\ directory with 2 .dat files, so it should add 2 entries to the TListView, but the code always genenrate an EAccessViolation error at the line where the FindFirst is executed. Any idea what I've done wrong? Any better suggestion to read/list files in a directory? (I've tried with the Windows API version of FindFileFirst too, and the result is simillar - it gives access violation in some random location). Thanks in advance. |