Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spaces in path names

Status
Not open for further replies.

michaelkatz

Programmer
Sep 1, 2002
50
GB
We distributa an application and if the user installs it in a folder that includes a "space" in the path name, it gernerates eroor # 202 "Invalid Path or File Name".

Tried enclosing path name in quotes and it still doesn't work.


Any Ideas?
 
Or to expand on Dave's idea:
Code:
lcTable = "C:\PROGRAM FILES\MICROSOFT VISUAL FOXPRO 7\MyTable"
USE (lcTable)
or
USE "&lcTable"
Rick

 
ldir = "c:\inventory\data"
ldir = addbs(ldir)
ldata = ldir + allt("items.dbf ")
use (ldata)


its me : ALEX
 
You can also use an API call to return a legal DOS path... This will give you a path that does not require the extra workarounds for macro substitution and such.

****************************************************************
Function GetShortPath
****************************************************************
Parameters cFileName
Private nRes, cPath

Declare Integer GetShortPathNameA In Win32API As GetShortPathName String, String, Integer

cPath = Replicate(Chr(32), 165) + Chr(0)
nRes= GetShortPathName(cFileName, @cPath, 164)

Clear Dlls GetShortPathName

Return (Left(cPath, nRes))

Endfunc

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top