468,512 Members | 1,341 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

How can i open a directory

Hi all,
i need to open multiple files that are in directory and parse
each file.iam using c language in VC++ compiler.how can i open a
directory.i tried it by including header file dirent.h.but its giving
error as shown below.
: fatal error C1083: Cannot open include file: 'dirent.h': No such
file or directory
please suggest me if any other way to overcome this
problem.
Thanks in advance.

Sep 7 '06 #1
7 5308
lakshmi wrote:
Hi all,
i need to open multiple files that are in directory and parse
each file.iam using c language in VC++ compiler.how can i open a
directory.i tried it by including header file dirent.h.but its giving
error as shown below.
: fatal error C1083: Cannot open include file: 'dirent.h': No such
file or directory
please suggest me if any other way to overcome this
problem.
Thanks in advance.
Ask in a VC++ group, this is a platform rather than a C question.

--
Ian Collins.
Sep 7 '06 #2
"lakshmi" <la************@gmail.comwrote:
i need to open multiple files that are in directory and parse
each file.iam using c language in VC++ compiler.how can i open a
directory.
RTFF: <http://c-faq.com/osdep/readdir.html>

Richard
Sep 7 '06 #3
lakshmi a écrit :
Hi all,
i need to open multiple files that are in directory and parse
each file.iam using c language in VC++ compiler.how can i open a
directory.i tried it by including header file dirent.h.but its giving
error as shown below.
: fatal error C1083: Cannot open include file: 'dirent.h': No such
file or directory
please suggest me if any other way to overcome this
problem.
Thanks in advance.
The first thing you have to learn is how to read the documentation.
VC++ comes with a lot of documentation and you will have to learn how to
use it before continuing. Go (in the IDE) to the Help menu item
and look what is in there.

Learn how to read and find functions in there because if you
don't you will come back here at each thing that you want to do.

HINT
findfirstfile
findnextfile
Sep 7 '06 #4
lakshmi wrote:
>
i need to open multiple files that are in directory and parse
each file.iam using c language in VC++ compiler.how can i open a
directory.i tried it by including header file dirent.h.but its giving
error as shown below.
: fatal error C1083: Cannot open include file: 'dirent.h': No such
file or directory
I suspect there is no such file as "file.iam", or "compiler.how" or
"directory.i" on your system. There certainly is no such include
file as "dirent.h" on a standard C system.

Hint: You are allowed to insert blanks after a sentence, and the
personal pronoun I is always capitalized.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Sep 7 '06 #5
Check if the include path in your IDE is set correctly...
If yes then check if the exist in the system or not..

-Ratan

CBFalconer wrote:
lakshmi wrote:

i need to open multiple files that are in directory and parse
each file.iam using c language in VC++ compiler.how can i open a
directory.i tried it by including header file dirent.h.but its giving
error as shown below.
: fatal error C1083: Cannot open include file: 'dirent.h': No such
file or directory

I suspect there is no such file as "file.iam", or "compiler.how" or
"directory.i" on your system. There certainly is no such include
file as "dirent.h" on a standard C system.

Hint: You are allowed to insert blanks after a sentence, and the
personal pronoun I is always capitalized.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Sep 8 '06 #6
"Ratan" <ra*******@gmail.comwrites:
Check if the include path in your IDE is set correctly...
If yes then check if the exist in the system or not..
Ratan, please don't top-post.

See <http://www.caliburn.nl/topposting.htmlfor an explanation, and
most of the articles in this newsgroup for examples of how to do it
right.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sep 8 '06 #7
"lakshmi" <la************@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
Hi all,
i need to open multiple files that are in directory and parse
each file.
Just go away and use VB:

-----------------------------
Sub DoDirs (cwd)

For Each objFolder in cwd.SubFolders

For Each fname in objFolder.Files

'do something with the files

Next

' recurse
DoDirs objFolder

Next

End Sub

' Get the current working directory (cwd)
Set fso = CreateObject("Scripting.FileSystemObject")
Set cwd = fso.GetFolder (".")

DoDirs (cwd)
-----------------------------
--
Mabden
Sep 30 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by jbailo | last post: by
reply views Thread by KevinGravelle | last post: by
5 posts views Thread by John Black | last post: by
6 posts views Thread by Bruce | last post: by
24 posts views Thread by dancer | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.