Page 1 of 1

Spaces in directory name

Posted: Mon Jun 10, 2013 11:20 am
by Micheline_NOEL_(Guest)
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.

=> RE: Spaces in directory name

Posted: Fri Jun 14, 2013 12:26 pm
by cstrasser
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))