www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/21/19:00:26

From: Laurence Withers <lwithers AT lwithers DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: findfirst and directories containing only subdirectories
Date: Wed, 21 Jun 2000 21:49:46 +0100
Message-ID: <FOKFUUAqpSU5Ew8b@lwithers.demon.co.uk>
NNTP-Posting-Host: lwithers.demon.co.uk
X-NNTP-Posting-Host: lwithers.demon.co.uk:194.222.80.1
X-Trace: news.demon.co.uk 961627762 nnrp-08:29083 NO-IDENT lwithers.demon.co.uk:194.222.80.1
X-Complaints-To: abuse AT demon DOT net
MIME-Version: 1.0
X-Newsreader: Turnpike Integrated Version 5.01 S <hlxPItNSbwmYszNzN6Z0zqnN6P>
Lines: 58
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

If I use findfirst() in a directory containing only one subdirectory,
and no other files, then it returns 22 and sets errno to 22 (which is
ENOENT). If the directory contains more than one subdirectory, this does
not appear to be a problem.

Here is some sample code:
- ------------------------------------------------------------------------
#include <iostream>
#include <dir.h>
#include <dirent.h>
#include <string>

extern int errno;

int main()
{
    ffblk B;
    string s;
    cout << "where? ";
    cin >> s;

    int i = findfirst(s.c_str(), &B, FA_DIREC);
    cout << "return value " << i << "; errno " << errno << endl;
    return 0;
}
- ------------------------------------------------------------------------

Create a subdir, say c:\a
Then create c:\a\b

Now run this and type "c:\a\*" (excluding quotes).
I get "return value 22; errno 22"

Then create c:\a\c

Now run this and type "c:\a\*" (ex. quotes)
I get "return value 0; errno 0"

Am I doing something wrong, or is this a bug in the findfirst
implementation?

Bye for now,
- -- 
Laurence Withers, lwithers AT lwithers DOT demon DOT co DOT uk
                http://www.lwithers.demon.co.uk/

-----BEGIN PGP SIGNATURE-----
Version: PGPsdk version 1.7.1

iQA/AwUBOVEqancA2AQvE3AZEQIUYQCgrqvqMnfn2VO+hUASMZxkj1sfCK8AnApS
fzi874hin6kWfd/95hE0UGLQ
=IfwO
-----END PGP SIGNATURE-----

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019