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
  • 65,924
  • 14
  • 115
  • 171
avivgood2
  • 207
  • 3
  • 17

1 Answers1

2

It should be NAME_MAX defined in <limits.h>

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

Jens
  • 65,924
  • 14
  • 115
  • 171
artm
  • 16,750
  • 4
  • 31
  • 51
  • 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