470,815 Members | 1,294 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Re: directories

On Jun 27, 12:19*pm, rober...@ibd.nrc-cnrc.gc.ca (Walter Roberson)
wrote:
In article <5ca9b844-3f81-4d71-8f7b-01c2122ad...@25g2000hsx.googlegroups.com>,

user923005 *<dcor...@connx.comwrote:
When you make a function call in C to any library function, you are
calling an API:
http://en.wikipedia.org/wiki/API
By what sort of magic do you expect to collect directory information
without using an API?

Original Unix filesystems, open the directory as a regular file and read
and interpret the byte-stream ?? There were convenient
fixed-width entries (14 characters, plus a two-byte inode number).
OS re-writing of entire directory blocks (e.g., compacting out
entries no longer used) was controversial, since doing so destroyed
assumptions that directories could be iterated through from begining
to end.
From the link that you cut to SFL, we have this directory API that
works on POSIX and Windows:

Directory access functions

Filename: sfldir.h
Package: Standard Function Library (SFL)
Written: 1996/04/02 iMatix SFL project team sf*@imatix.com
Revised: 2000/01/18
Copyright: Copyright (c) 1996-2000 iMatix Corporation
Synopsis

The directory access functions provide a portable interface to the
system's file directory structure. In general these functions are
modelled around the UNIX opendir and readdir functions, but they are
also similar to the DOS interface. These functions can fail on SVr4 if
the <dirent.hfile does not match the C library. Recompile with the
switch -D _USE_BSD_DIRENT and they should work a bit better. Tested
on: MS-DOS (Turbo-C), Windows (MSVC 4.0), UNIX (Linux, IBM AIX,
SunOS). OS/2 port was done by Ewen McNeill ew**@naos.co.nz. DJGPP and
DRDOS LFN by Rob Judd ju**@alphalink.com.au. Changes for Win32 by Will
Menninger wi****@netcom.com.
List of Functions

* Bool open dir
(DIRST *dir, const char *dir_name);
* Bool read dir
(DIRST *dir);
* Bool close dir
(DIRST *dir);
* char * format dir
(DIRST *dir, Bool full);
* int fix dir
(DIRST *dir);
* int free dir
(DIRST *dir);
* char * resolve path
(const char *path);
* char * locate path
(const char *root, const char *path);
* char * clean path
(const char *path);
* NODE * load dir list
(const char *dir_name, const char *sort);
* void sort dir list
(NODE *filelist, const char *sort);
* FILEINFO * add dir list
(NODE *filelist, const DIRST *dir);
* void free dir list
(NODE *filelist);
* char * get curdir
(void);
* int set curdir
(const char *path);
* Bool file matches
(const char *filename, const char *pattern);
* int make dir
(const char *path);
* int remove dir
(const char *path);
* qbyte dir usage
(const char *path, Bool recurse);
* qbyte dir files
(const char *path, Bool recurse);

Jun 28 '08 #1
0 1369

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Tum | last post: by
4 posts views Thread by rn5a | last post: by
1 post views Thread by rn5a | last post: by
6 posts views Thread by =?Utf-8?B?WW9naSBXYXRjaGVy?= | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.