Hello,

In s project I'm about to start I'm going to need the ability to search for files, so I figured I would use the _findfirst() function. I've used it in previous projects with no problems, but when I tested the function like so:

_finddata_t information;

long reference = _findfirst("*",&information);

while(_findnext(reference,&information) != -1)
{
    cout << information.name << endl;
}

_findclose(reference);

I notice that it is missing one file. It is the same file no matter if I rename it, delete other files. If I move it to another folder it can be found.

It isn't set to read only or hidden. It is a shortcut to a program, but there are other shortcuts that it does return.

I am aware that I'm ignoring the file found in _findfirst, but that should just be the "." reference to the current directory (just double checked, it is)

Any help would be much appreciated.

It's missing the first file because your program is tossing it into the bit bucket. findfirst() finds the first file then your program immediately calls findnext(), which dumps the result from findfirst(). You need to rearrange the logic of that funcion so that it does something with the results of findfirst()

I addressed that concern in my first post here:

I am aware that I'm ignoring the file found in _findfirst, but that should just be the "." reference to the current directory (just double checked, it is)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.