Re: directory data structure



On Jun 28, 7:15 pm, Maxwell Lol <nos...@xxxxxxxxxxx> wrote:
sid <kingsiddha...@xxxxxxxxx> writes:
Hi
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. I want to access it directly
without any API. Any help is welcome.

This doesn't make any sense.
If you don't want an API, then why use C?
You could use the API built into perl. But that's another API.
If you truly want to NOT use an API, use shell commands, not C.

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.

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
    ... sid writes: ... I found out that we could use an API provided by dirent.h header file, ... If you truly want to NOT use an API, use shell commands, not C. ...
    (comp.os.linux.misc)
  • RE: [RFC] transcendent memory for Linux
    ... Should this API be documented, ... able to use preswap, else it will not). ... write and a disk read are avoided. ... the page is written to swap as usual. ...
    (Linux-Kernel)
  • Re: CreateFile fails when trying to Write on DVD/CDROm
    ... ordinary disk drive. ... You can also get third-party driver software (like Adaptec/Roxio's DirectCD ... not use the standard CD or DVD formatting, and the disk will only be ... MS have an API called the Image Mastering API ...
    (microsoft.public.vc.mfc)
  • Re: convert byte[] to an type
    ... label program API. ... I've serialized a file from disk to a byte array. ... may be able to create a named pipe and hand the path to said pipe to the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: [RFC] transcendent memory for Linux
    ... Should this API be documented, ... visible to the kernel (but, briefly, if the kernel is being ... able to use preswap, else it will not). ... write and a disk read are avoided. ...
    (Linux-Kernel)