[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How do I convert a short path name to a long path name

Posted on 2000-03-14
4
Medium Priority
?
555 Views
Last Modified: 2012-05-04
Hi,

I want to convert a short path name like e.g.
  "c:\progra~1\mystuff"
to
  "c:\program files\mystuff"

I found the function GetLongPathName, but this only works for WinNT 5.0 and Win98 and later versions. The function GetFullPathName doesn't help me either.

/Brian
0
Comment
Question by:Brian_HP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
ufolk123 earned 300 total points
ID: 2615139
Hi Brian HP.

There is ont technique you can use:

FindFirstFile() give you the long path name of a file given the short path name (8.3 style) path name.

For example
h=FindFirstFile("c:\\progra~1",lpFindFileData)
will return you program files in lpFindFileData cFileName field.
May be you can invoke this funciton for each path component and strcat them to get the Windows style full path name.

Hope this helps
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 2615235
Hi Brian_HP,

At http://indigo.ie/~pjn/ in section 'Code Snippets' you can find complete code which emulates this GetLongPathName() function using FindFirstFile() API function.

hope that helps,

ZOPPO
0
 
LVL 3

Expert Comment

by:ufolk123
ID: 2615372
Yes code snippen by ZOPPO looks ok and on the same lines as i suggested but it uses CString .You may have to modify the code a little if yours is pure C Win32 APP as CString is not portable (Only in VC++).
0
 

Author Comment

by:Brian_HP
ID: 2616198
Thanks to both of you!
/Brian
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question