>just wanna ask if c++ opendir,readdir and closedir code can be implemented in visual c++
They're not supported by the library, but you can write versions of them if you really want to using FindFirstFile and FindNextFile.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>if u can post the names of that kind of functions
Are you blind? I gave you the two functions that you need to do what you want to do, whether it's faking POSIX functions, or solving your problem with the straight Windows functions. Now go to MSDN and do the research on them. And in case you missed it the first two times:
FindFirstFile and FindNextFile
Geez.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
I know this is very old code from the attic and dusted off a little. It might give you a hint or confuse you totally.
[php]
// read the filenames from a given directory
// globals
#define MAXFILES 1500 // maximum filenames in buffer
char fbuf[MAXFILES][80]; // filename buffer
int fbntotal; // total number of filenames in buffer
struct {
char reserved[21];
char attribute;
int time;
int date;
long size;
char name[13];
} dirdata; // structure for directory info
...
// read the files in the directory specified in path
// needs full pathname consisting of drive, path and dirname
// reads filenames into a global buffer
void fs_readdir(char *path)
{
int k, done;
done = findfirst(path,&dirdata,0);
for (k = 0; !done; k++)
{
sprintf(fbuf[k],"%s",dirdata.name);
done = findnext(&dirdata);
if (k >= MAXFILES)
break;
}
fbntotal = k; // total entries in filename buffer
}
[/php]
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417