0

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.

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by zacory
0

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()

0

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)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.