其中PATH_MAX在Linux下定义的? [英] Where is PATH_MAX defined in Linux?

查看:8716
本文介绍了其中PATH_MAX在Linux下定义的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这头文件,我应该调用与的#include 来能够使用PATH_MAX为int大小字符串?

Which header file should I invoke with #include to be able to use PATH_MAX as an int for sizing a string?

我希望能够宣布:

char *current_path[PATH_MAX];

但是,当我这样做,我的编译器(铛/ LLVM在Linux上)发出了以下错误:

But when I do so my compiler (Clang/LLVM on Linux) issues the following error:

recursive_find6.c:29:20: error: use of undeclared identifier 'PATH_MAX'
char *current_path[PATH_MAX];
                   ^

我试着做了谷歌搜索,但仍然没有运气。

I tried doing a google search but still no luck.

的#include< limits.h中方式> 不解决问题/错误

我是否还正确的,PATH_MAX的值是一个int?

Am I also correct that the value of PATH_MAX is an int?

推荐答案

及其的Linux / limits.h中。结果
的#define PATH_MAX 4096 / *#字符的路径名,包括NUL * /

#include <linux/limits.h>

char current_path[PATH_MAX];

PATH_MAX 有一些缺陷在的这个博客(感谢paulsm4)

PATH_MAX has some flaws as mentioned in this blog (thanks paulsm4)

这篇关于其中PATH_MAX在Linux下定义的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆