From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Detecting longfilename support.. Date: Mon, 10 Feb 1997 21:01:27 +0000 Organization: None Distribution: world Message-ID: References: <32ff64ab DOT 14004877 AT news DOT ox DOT ac DOT uk> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 17 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp 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 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'. */