1

How can I determine the maximum file path length allowed in the system my program is running on? Is it in limits.h? because I didn't find it there.

Jens
  • 69,818
  • 15
  • 125
  • 179
avivgood2
  • 227
  • 3
  • 19

1 Answers1

2

It should be NAME_MAX defined in <limits.h>

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html

Jens
  • 69,818
  • 15
  • 125
  • 179
artm
  • 17,291
  • 6
  • 38
  • 54
  • It says that this is an implementation - defined constant – avivgood2 May 09 '20 at 06:39
  • yeah usually it's on Linux system, not sure if it's also the same for Windows or MacOS – artm May 09 '20 at 06:42
  • @avivgood2 Yes, implementation-defined is a good as it gets. It means the implementation must provide a document stating the value (and limits.h contents may be enough for that). NAME_MAX is not constant across the universe, as say, the speed of light. :-) – Jens May 09 '20 at 10:59