🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Finding Files

#12620
From: Luiz Rafael Culik Guimaraes
Date: Sun, 23 Nov 2003 12:51
52 lines
2060 bytes
Dear Friends

How to check if file meat certain attributes.
It some times fails to get all files with certain conditions, specialy if
passeded an root dir (c:\*.* / d:\*.*)


My code is

#include "windows.h"
#include "stdio.h"

void FindData(char * szFile );
int main(int argc, char* argv[])
{
char * szPath;
szPath=argv[1];
FindData(szPath);
}

void FindData(char * szFile )
{
   HANDLE          hFindFile;
   WIN32_FIND_DATA pFindFileData;
   DWORD           dwAttr;
   int i =0;
   hFindFile = FindFirstFile( szFile, &pFindFileData );
   dwAttr    = |FILE_ATTRIBUTE_READONLY |FILE_ATTRIBUTE_DIRECTORY;

   if (hFindFile != NULL )
   {
      do
      {
           if( dwAttr & pFindFileData.dwFileAttributes  )
           {
                printf("File Name: %s : ",pFindFileData.cFileName);
                i++;
           }
      } while(FindNextFile(hFindFile,&pFindFileData)==TRUE);
   }
   printf(" %d ",i );
}


Regards
Luiz


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.541 / Virus Database: 335 - Release Date: 14/11/2003
Technical Details
Message-ID: <3fc0ad9b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-out1.nntp.be!propagator2-sterling!news-in-sterling.newsfeed.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,7c19047fd3108cd2,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-11-23 05:03:45 PST
From: "Luiz Rafael Culik Guimaraes" <culikr@uol.com.br>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Finding Files
Date: Sun, 23 Nov 2003 10:51:19 -0200
Lines: 54
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 200.96.127.36
Message-ID: <3fc0ad9b$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1069591963 200.96.127.36 (23 Nov 2003 04:52:43 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-out1.nntp.be!propagator2-sterling!news-in-sterling.newsfeed.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail