Mail Archives: djgpp/1997/05/08/13:05:03
On Mon, 5 May 1997, Zastai wrote:
> Also, is there any way to get a LFN version of _argv[0]?
You mean, on Windows 95, right? Just call `_truename' library function on
argv[0] that you get: it should return the long name.
But there is a catch (as always with Microsoft): if the program .exe file
resides on a networked drive, you might get some redirector-specific
string instead of the drive letter in what `_truename' returns. For
example, if F: is a networked drive and you invoked
f:\util\LongProgName.exe, `_truename' might return something like
"\\VOL23\DEPT87\util\LongProgName.exe". If you then feed this value into
a file-oriented function, it might fail. So if you get such a pathname,
you will need to restore the original drive letter. The easiest way is to
call `_truename' on "f:/", it should return "\\VOL23\DEPT87", and you then
know which part of the full pathname do you need to nuke.
- Raw text -