Mail Archives: djgpp/1997/02/11/12:42:35
George Foot writes:
>>Is it possible, during runtime, to detect if long filenames is
>>supported (the LFN=y is set in the djgpp.env file)
>
> int lfn=(toupper(getenv("LFN")[0])=='Y');
Two problems with that. For one, it will crash if LFN isn't in the
environment (getenv will return NULL, and we all know what happens when
you dereference the NULL pointer :-) More seriously, it only tells you
the environment settings, not whether the OS is actually supporting
them. Instead, you should include <fcntl.h> and check the value of the
_USE_LFN() macro.
/*
* Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
* Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'.
*/
- Raw text -