Running a variety of Linux? Ever wonder just how long a path name can be or a file name or both? Want to out?
Copy this code and paste it into file.c
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <limits.h>
int main(int argc, char* argv[])
{
printf("Max path is %d\n", PATH_MAX);
printf("File max is %d\n", NAME_MAX);
return 0;
}
Compile it with:
$ cc -o path-name_max file.c
Run it:
S ./path-name_max Max path is 4095 File max is 255
Permission to use this code is granted. Permission to reference this material is granted. All content and program code is licensed under the GNU General Public License. Your use of this code signifies your acceptance of the terms and conditions set forth therein.
| All content © 2003-2008 Jeff Stoner |