🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6647

Re: FindFirst FindNext Problems

#6647
From: Colin B Maharaj
Date: Thu, 21 Apr 2005 11:42
98 lines
3762 bytes
Got it!!
Thanks folks for responding here is what i found...
http://tinyurl.com/exm8k

Also here is what I did on my PC - based on my code I removed the 
Archive Attribute on all my files - and The system was not able to list 
any files - thank goodness I was able to replicate the problem.
Then I decided to put back the archive attribute and low and behold - I 
still was not able to list my directory (?????)

Anyway, based on the link here what I did...

....
....
    int faAnyFile2 = 0x0000FFFF;
    TSearchRec sr;
    int iAttributes = 0;
    SaveCurPath  SaveCurPath;
    iAttributes |= faAnyFile2;
    AnsiString FileSpec = Site_Path;
    FileSpec += fs;
    if (FindFirst(FileSpec, iAttributes, sr) == 0)
    {
      if (!(sr.Attr & faDirectory)
      {
        AnsiString FileName = Site_Path;
        FileName += sr.Name;
        strcpy(ftbk[count].Name, FileName.c_str());
        ....
        ....
        ...

This worked OK.
I will need to fax Borland soon to get my Beta and see if these problems 
still exists....





Colin B Maharaj wrote:
> 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: <4267919f@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42675e43$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,703d67222767022e
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Thu, 21 Apr 2005 07:42:24 -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: Re: FindFirst FindNext Problems
References: <42675e43$1@newsgroups.borland.com>
In-Reply-To: <42675e43$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 200.108.25.133
Message-ID: <4267919f@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1114083743 200.108.25.133 (21 Apr 2005 04:42:23 -0800)
Lines: 98
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail