C++ Standard Library C++ STL Library

C++ <cstdio> - FILENAME_MAX constant



The C++ <cstdio> FILENAME_MAX is a macro constant that expands to an integral expression corresponding to the size needed for an array of char elements to hold the longest file name string allowed by the library. If the library imposes no such restriction, it is set to the recommended size for character arrays intended to hold a file name.

In the <cstdio> header file, it is defined as follows:

#define FILENAME_MAX /* implementation defined */             

Example:

The example below shows the value of FILENAME_MAX constant on a given implementation.

#include <cstdio>
 
int main (){
  //displaying the value of FILENAME_MAX
  printf("FILENAME_MAX = %d\n", FILENAME_MAX);
 
  return 0;
}

One of the possible output of the above code could be:

FILENAME_MAX = 4096

❮ C++ <cstdio> Library