Article View: borland.public.cppbuilder.nativeapi
Article #5511Re: GetTempPath() and the ugly "~1" How to get the *full path* ??
From: Oren Halvani
Date: Thu, 11 Aug 2005 02:03
Date: Thu, 11 Aug 2005 02:03
49 lines
2716 bytes
2716 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> schrieb im Newsbeitrag
news:42faa901$1@newsgroups.borland.com...
> So? Just because portions of the path are in 8.3 format does not mean that
> the path is invalid, because it is not. You can still use 8.3 paths in
> modern operations just fine.
i know, i know :-)
> Why do you care whether you have a short path or a long path? Both work
> equally as well.
again: i know, but i have to show the user the full path + file...if i would use it
internal in the program, i realy wouldn't care about it:-)
> If you must get the long name, then pass the short path to either
> GetLongPathName() or FindFirstFile().
Remy, i've tryed: GetLongPathName() but the compiler didn't recognized it
what do i need to include..? i've choosed FindFirstFile() instead,
but it returns me ONLY the filename !
i need the full path + filename...
here's what i got...don't expect too much i'm very, very tired :-)
/*********************************************************/
AnsiString TfrmMainUnit::GetTempFile()
{
char TempDir[MAX_PATH + 1]; TempDir[MAX_PATH] = '\0';
GetTempPath(MAX_PATH, TempDir);
String filename = "ShowRecord-Tempfile",
newPath = TempDir + filename;
WIN32_FIND_DATA FindFileData;
HANDLE hFind = FindFirstFile(newPath.c_str(), &FindFileData);
if(hFind != INVALID_HANDLE_VALUE)
{
FindClose(hFind);
//ShowMessage(FindFileData.cFileName); // Check before returning..
return(FindFileData.cFileName);
}
else
{
ShowMessage("Invalid File Handle. GetLastError reports: " + GetLastError());
return(0);
}
}
Technical Details
Message-ID:
<42fab1ed@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<42fa9d15@newsgroups.borland.com> <42faa901$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,420a348eb6918014 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Thu, 11 Aug 2005 04:03:26 +0200 From: Oren Halvani <xx@xx.com> User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: GetTempPath() and the ugly "~1" How to get the *full path* ?? References: <42fa9d15@newsgroups.borland.com> <42faa901$1@newsgroups.borland.com> In-Reply-To: <42faa901$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 84.176.90.53 Message-ID: <42fab1ed@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1123725805 84.176.90.53 (10 Aug 2005 19:03:25 -0700) Lines: 49 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail