473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Dirent.h

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???

Feb 26 '06 #1
3 11273
sa*********@gmail.com wrote:
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
Feb 26 '06 #2
sa*********@gmail.com wrote:
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
Feb 26 '06 #3
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

<sa*********@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
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???

Feb 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Martin Pohlack | last post by:
Hi, I have a funtion which shall compute the amount for a later malloc. In this function I need the sizes of some struct members without having an instance or pointer of the struct. As...
14
by: **--> That Guy Downstairs | last post by:
What files are needed to be #included to be able to copy files to a new directory and be portable? ie. use it in Unix (SGI and Linux) or Windows 2000. #ifdefs Ok. using dirent.h on SGI, but...
9
by: collection60 | last post by:
I've been developing some Unix based shell tools. They work fine on Linux and MacOSX. I want to compile them on Win32. But I can't get hash_map to compile. I tried downloading stl (and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.