Dirent.h

S

sargonisaac

I am trying to get Directory content list in VC++ 2003, here is my
code:

DIR *pdir;
struct dirent *pent;
char str[2000];
pdir=opendir("./users/" + FullName); //"." refers to the current dir
// if the dir doesnt exists, create it
if (!pdir){
mkdir("./users/" + FullName);
}

It says to use dirent.h and i cannot find it or it has not been found.
Can someone please help, am i doing something wrong or is there another
way of doing it???
 
G

Gianni Mariani

I am trying to get Directory content list in VC++ 2003, here is my
code:

DIR *pdir;
struct dirent *pent;
char str[2000];
pdir=opendir("./users/" + FullName); //"." refers to the current dir
// if the dir doesnt exists, create it
if (!pdir){
mkdir("./users/" + FullName);
}

It says to use dirent.h and i cannot find it or it has not been found.
Can someone please help, am i doing something wrong or is there another
way of doing it???


This is not standard C++ - hence off topic in this NG.

Try a Microsoft NG -

perhaps:
microsoft.public.vc.language
 
M

Moonlit

Hi,

I might be wrong but I thought those functions are only available on unix.
Under windows use:

FindFirstFileEx

and friends.

Make sure to set the right WINNT version in the header otherwise you might
be pretty puzzled about the messages you get :-(

_WIN32_WINNT 0x400

or something like that in StdAfx.h

--


Regards, Ron AF Greve

http://moonlit.xs4all.nl
 
L

Larry I Smith

I am trying to get Directory content list in VC++ 2003, here is my
code:

DIR *pdir;
struct dirent *pent;
char str[2000];
pdir=opendir("./users/" + FullName); //"." refers to the current dir
// if the dir doesnt exists, create it
if (!pdir){
mkdir("./users/" + FullName);
}

It says to use dirent.h and i cannot find it or it has not been found.
Can someone please help, am i doing something wrong or is there another
way of doing it???

This is Unix/Linux code (DIR, opendir(), dirent).
Do the Microsoft headers/libs support/contain these functions
and structures?

Also, opendir() and mkdir() take C strings (char *) as their
args, not C++ std::string args. So the syntax like

"./users/" + FullName

won't work.

Larry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top