[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

RE: Reading directories and files




| Hello,
|    How does one contents of the current (or any) directory using C.
| How can I traverse the directory tree from a C program.

See opendir and readdir functions.
I've checked the man pages, but I couldn't understand them. They talk about two different structures, DIR and dirent. I'm not certain if I can, or how I can extract the names from these structures.(The functions return pointers to these structures

"info libc"

I'll look at this.

| If I locate a file in a given directory(after a random set of
| traversals) is
| there a way to obtain its absolute path in the form of a string?

I don't understand this. If you can locate a file, you should know the
directory ;-).

Well, If I'm trying to create a dialog box, to traverse my filesystem,
I don't want to keep track of the prefix pathname. It is easier if the I can obtain my position automatically when required.

Rajeev





**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

---------------------------------------------
LIP is all for free speech.  But it was created
for a purpose.  Violations of the rules of
this list will result in stern action.

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.