Article View: borland.public.cppbuilder.nativeapi
Article #6644FindFirst FindNext Problems
From: Colin B Maharaj
Date: Thu, 21 Apr 2005 08:03
Date: Thu, 21 Apr 2005 08:03
55 lines
2527 bytes
2527 bytes
I am using these functions to find files in my apps path to do a backup.
IN win2000 server (at just one customer's site) it fails. Actually it
does not fail per say it just returns zero files / zero bytes. No access
violations nothing.....
Here is my code...
//---------------------------------------------------------------------------
struct FilesToBackup
{
char Name[MAX_PATH];
int Size;
};
//---------------------------------------------------------------------------
// fs could be "*.dat"
// Site_Path is where the files are being search from
void TBackupData::PopulateBkupList(FilesToBackup * ftbk, char *fs, int &
count)
{
TSearchRec sr;
int iAttributes = 0;
// SaveCurPath SaveCurPath;
iAttributes |= faArchive;
AnsiString FileSpec = Site_Path;
FileSpec += fs;
if (FindFirst(FileSpec, iAttributes, sr) == 0)
{
if (sr.Attr == iAttributes)
{
AnsiString FileName = Site_Path;
FileName += sr.Name;
strcpy(ftbk[count].Name, FileName.c_str());
ftbk[count].Size = sr.Size;
count++;
//ValidateDate(sr.Name);
}
while (FindNext(sr) == 0)
{
if (sr.Attr == iAttributes)
{
AnsiString FileName = Site_Path;
FileName += sr.Name;
strcpy(ftbk[count].Name, FileName.c_str());
ftbk[count].Size = sr.Size;
count++;
//ValidateDate(sr.Name);
}
}
FindClose(sr);
}
}
Technical Details
Message-ID:
<42675e43$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,703d67222767022e,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Thu, 21 Apr 2005 04:03:20 -0400 From: Colin B Maharaj <noreply@myhost.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a4) Gecko/20040927 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: FindFirst FindNext Problems Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 200.108.25.133 Message-ID: <42675e43$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1114070595 200.108.25.133 (21 Apr 2005 01:03:15 -0800) Lines: 55 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail