Re: directory data structure



On Jun 28, 7:58 pm, Dances With Crows <danceswithcr...@xxxxxxx> wrote:
Maxwell Lol staggered into the Black Sun and said:

sid <kingsiddha...@xxxxxxxxx> writes:
I want to write a C program that can read directories (say list them
as well).  I found out that we could use an API provided by dirent.h
header file, but I am not too keen on using the API.

?  opendir() and readdir() are how this is done in C.  They are not
insanely complex and there's a large amount of sample code that uses
those functions out there.  Read some of that sample code and understand
it, then use the concepts you learn.

I want to access it directly without any API.
This doesn't make any sense.  If you don't want an API, then why use
C?

It is not clear what the OP wants.  Maybe the OP should explain better.
The other thing that he could be thinking about is open()ing the
directory itself.  This is not a good idea, because some programmers who
are more paranoid and dedicated than you have already written opendir()
and its friends, and Laziness is one of the virtues of a programmer.

Use dd(1) to read raw data from the disk and enjoy parsing binary
information, where you need the info in the *.h files.  Or use ls(1),
find(1) and other shell commands.

dd is probably the wrong tool for the job as well, since it refuses to
dump data if you do "dd if=somedir/ ..." .

--
   "Assembly of God". Haven't you ever wondered what goes on in a place
   like that?  What kinds of parts does God need?  --Slacquer
  My blog and resume:http://crow202.dyndns.org/wordpress/
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see

Actually what I was thinking of was that since everything is a file
in
a Linux kernel/system, I would just read the directory files and
interpret them... and I know that we could do so in the older
versions
of Linux as well as UNIX. Say, if you wanted to read the current
directory, you could just do "od -bc ." and this would octal dump the
contents the of current directory. Also, even now you could read the
contents of the directory file using VI ( vi <directory name> ). So I
planned to do something similar and was thinking that you guys might
help me with it.

Thanks


.



Relevant Pages

  • Re: directory data structure
    ... header file, but I am not too keen on using the API. ... insanely complex and there's a large amount of sample code that uses ...  This is not a good idea, because some programmers who ...
    (comp.os.linux.misc)
  • Re: NullPointerException
    ... > programmers do make that assumption. ... I told them how they can prevent NullPointerExceptions. ... > public boolean hasAddress() ... It was returned from some API. ...
    (comp.lang.java.programmer)
  • Re: DllMain vs. DllMain
    ... obey the MSDN page that says what the API itself is? ... contains instructions for VC++6 programmers or descriptions of the APIs ... work this morning and fail this afternoon because undocumented behaviour is ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Transaction Oriented Architecture (TOA)
    ... Given embedded SQL mapping an account /thing/ to the DB as: ... then the SQL is dependent on: an account table/view, its columns, and the explicit reference to accountKey. ... Procedure names and their arguments should be considered as an API to the DB's solution domain. ... this kind of interface is common among object oriented languages and isn't a foreign concept to OO programmers. ...
    (comp.object)
  • Re: Shortage of qualified Java programmers
    ... library of Java is what you have computers for -- not people. ... every detail of the API. ... to figure out how a Comparator works given the Javadocs. ... programmers written by Bill Venners. ...
    (comp.lang.java.programmer)