🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Finding Files

#12622
From: Bob Gonder
Date: Sun, 23 Nov 2003 17:24
32 lines
1863 bytes
Luiz Rafael Culik Guimaraes wrote:

>How to check if file meat certain attributes.
(meat is food, you meant meet)


>   DWORD           dwAttr;
>   hFindFile = FindFirstFile( szFile, &pFindFileData );
>   dwAttr    = |FILE_ATTRIBUTE_READONLY |FILE_ATTRIBUTE_DIRECTORY;

	Don't need the first |

>   if (hFindFile != NULL )

This "if" is wrong. [from help]
"If the function fails, the return value is INVALID_HANDLE_VALUE"
which is not NULL.
Try this:
     if( hFindFile == INVALID_HANDLE_VALUE )
     {	printf( "FindFirstFile Error# %i\r\n",GetLastError() );
     }else{

>           if( dwAttr & pFindFileData.dwFileAttributes  )
>           {
>                printf("File Name: %s : ",pFindFileData.cFileName);

Only prints directories or ReadOnly files.
Is that what you wanted to do?

>}

Don't forget to use FindClose();
Technical Details
Message-ID: <j9q1svoc9p255rinnfab7mqopmgp7pfv90@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3fc0ad9b$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,7c19047fd3108cd2
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-11-23 09:35:10 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Finding Files
Date: Sun, 23 Nov 2003 09:24:39 -0800
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <j9q1svoc9p255rinnfab7mqopmgp7pfv90@4ax.com>
References: <3fc0ad9b$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.31.164.132
X-Trace: newsgroups.borland.com 1069608279 67.31.164.132 (23 Nov 2003 09:24:39 -0700)
Lines: 34
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail