473,765 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 11287
sa*********@gma il.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.publi c.vc.language
Feb 26 '06 #2
sa*********@gma il.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*********@gm ail.com> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.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
9237
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 "sizeof(int)" is legal I assumed "sizeof(struct x.y)" to be legal too. But is is not: #include <dirent.h>
14
6447
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 it's not working on Windows w/ VS6.0. Thanks.
9
4182
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 stlport) which is supposed to work in MSVC, but it doesn't, it just generates tons of errors for stuff that used to work just fine. Where do I get fts.h to compile and dirent.h compile?
0
10163
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9957
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8832
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5276
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.