"Mike Wahler" <mk******@mkwahler.netwrites:
"Jack Klein" <ja*******@spamcop.netwrote in message
news:g5********************************@4ax.com...
>On Mon, 26 Mar 2007 18:14:52 GMT, "Mike Wahler"
<mk******@mkwahler.netwrote in comp.lang.c:
>>#include <stdio.h>
#define FN_MAX_LEN 128 /* you need to determine best value for this */
[snip]
If you use the standard macro FILENAME_MAX from the already-included
<stdio.h>, the determination is done for you.
I always seem to forget about that one. Thanks.
FILENAME_MAX is not necessarily as meaningful as you might expect it
to be. The standard says it:
expands to an integer constant expression that is the size needed
for an array of char large enough to hold the longest file name
string that the implementation guarantees can be opened
with a footnote:
If the implementation imposes no practical limit on the length of
file name strings, the value of FILENAME_MAX should instead be the
recommended size of an array intended to hold a file name
string. Of course, file name string contents are subject to other
system-specific constraints; therefore all possible strings of
length FILENAME_MAX cannot be expected to be opened successfully.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"