On Fri, Apr 27, 2001 at 08:08:04PM -0700, [EMAIL PROTECTED] wrote:
> On Fri, 27 Apr 2001, Henry House wrote:
>
> > The header file linux/limits.h defines PATH_MAX, which is alegedly the limit
> > on path lengths. Is there a portable way to get the maximum path length?
>
> I think the closest you can get is:
>
> #include <stdio.h>
> char fname[ FILENAME_MAX ];
>From the libc manual:
*Usage Note:* Don't use `FILENAME_MAX' as the size of an array in
which to store a file name! You can't possibly make an array
that big! Use dynamic allocation (*note Memory Allocation::)
instead.
Also, there is not guaranteed to be an actual limit to path strings -
and some library calls which return paths may return strings lonter
than FILENAME_MAX, I believe. In the event that there is no actual
limit, PATH_MAX is not guaranteed to be defined, and FILENAME_MAX will
be defined to a very large number.
Micah