Re: opening files with spaces in pathname?
- Posted by DanM Mar 04, 2009
- 870 views
ghaberek said...
DanM said...
It's the PATHNAME (path + filename) that has spaces in some of the FOLDER'S NAMES that I think is making the file not open.
Or are you just not concatenating the string properly?
constant PATH = "C:\\Program Files\\Application" constant FILE = "filename.txt" sequence NAME = PATH & '\\' & FILE -- note the separating backslash
-Greg
Good question..I'm not sure, but I don't think so,
as I'm getting the path & file name from
Win32Lib dialog, "getOpenFileName":
setCurrentDirectory ("C:\\Programming\\EUPHORIA\\Programs Under Development\\FromIde\\VCRdataBase") fileName = getOpenFileName( Window1, -- parent window "", -- no default name { "Monthly TV Episodes", "*.mon", -- data files "All Files", "*.*" } ) -- everything else if length( fileName ) = 0 then setText({aStatus,1},"No File Selected") return end if puts(1, "\nthe filename: " & fileName) -- open the file handle = open( fileName, "r" ) while 1 do -- get data data = gets(handle) -- end of file? if atom(data) then exit end if end while puts(1, "\nthe monthly data:\n") pretty_print(1, data, {2}) close(handle)
and my debug reports read:
the filename: C:\Programming\EUPHORIA\Programs Under Development\FromIde\VCRdat aBase\HouseTvMar.mon
the monthly data: -1
Dan