Spaces in directory name

Meeting place for R&R customers and clients to share tips and ideas. Post your questions, messages or problems here.
Post Reply
Micheline_NOEL_(Guest)
Posts: 2
Joined: Tue Oct 10, 2017 12:44 pm

Spaces in directory name

Post by Micheline_NOEL_(Guest) » Mon Jun 10, 2013 11:20 am

Hi,____I ^m working with Dephi and the Viewer Dll.__My dbf files are in the directory c:Documents publicsdoss01 and my program has to tell R&R where are the master file, the index file of that master file and some other files (relations).____if I define my master file as : ^c:Documents publicsdoss01 g01024.dbf^ -> it does not work. If there is no space in the directory name -> it works... What should I do to work without error with space(s) in the directory name ?____Thanks a lot,____Micheline NOEL.

User avatar
cstrasser
Posts: 155
Joined: Tue Oct 10, 2017 12:44 pm

=> RE: Spaces in directory name

Post by cstrasser » Fri Jun 14, 2013 12:26 pm

I can think of a couple of solutions:____1. Place chr(34) at the start and end of the string you^re using to pass the folder____2. Use the 8.3 version of the windows folder: Then c:documents and settingsmy documents he data becomes:____c:docume~1mydocu~1 hedat~1\____Below is the code I used for another client (it^s in FoxPro, but it^s a basic Windows API call):____PARAMETERS pLongName____DECLARE INTEGER GetShortPathName IN kernel32;__ STRING lpszLongPath,;__ STRING @ lpszShortPath,;__ INTEGER cchBuffer____lpShortPath = GetShort(pLongName)____FUNCTION GetShort(lcName)__ LOCAL lcBuffer, lnResult__ lcBuffer = Repli(Chr(0), 512)__ lnResult = GetShortPathName(lcName, @lcBuffer, Len(lcBuffer))____ RETURN IIF(lnResult=0, "error #" + LTRIM(STR(Error())), Left(lcBuffer, lnResult))
Chris Strasser
Liveware Publishing, Inc.
Work bigger.

Post Reply