[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Odd behaviour with -d ?



Matthias,

Thanks for your note.

>Alan,
>
>it seems that you still have conceptual problems understanding
>opendir()/readdir().

Rem acu tangere.

>But in fact the principle is fairly simple:
>
>readdir returns only the *leaf names* of files, not their *path names*.
>i.e., when you read directory a:b with files a:b:f1 and a:b:f2 in it,
>readdir returns ("f1", "f2").
>
>The reason for this is partly historical: In the old days, Un*x directories
>were simply files containing a list of <leaf name, inode nr> pairs. When the
>exact format of these files started changing, readdir was introduced as
>a slightly more abstract interface.

Yes, I have the hang of it now, although understanding is limping along
behind a little. Central to my misconception was the pious hope that
'opendir()' implied a 'chdir()', so that if you could open the larder door
with opendir() you would find yourself in there amongst the cans of
baked-beans.

Alan.