[Gambas-user] Problem with Exist & Open functions with filename containing spaces

John Rose john.aaron.rose at ...626...
Thu Mar 12 11:07:14 CET 2015


I have coding of:
  sPlainPath = User.Home &/ "plain out"
  Print "PlainPath=" & sPlainPath
  If Exist(sPlainPath) Then
    Print sPlainPath & " exists"
  Else
    Print sPlainPath & " does not exist"
  Endif
  hPlain = Open sPlainPath For Input
  While Not Eof(hPlain)
    Line Input #hPlain, sLine
    PlainTextArea.Text &= sLine & "\n"
  Wend
  Close #hPlain

The file 'plain out' is in my home directory. At runtime, I get popup of
'File or Directory does not exist'. This occurs even if I remove the 'If
Exist(sPlainPath)...Endif' lines, which I only put in as the same error
dialog popup also appeared in that situation. I've tried using single
quotes to begin & end the sPlainPath value. I'm not able to amend the
filename to exclude its inner space character as it's created by a
command line program over which I have no control. Only solution that I
can think of is to use Shell commands (where I presume that single
quotes can encircle the filename) to copy/move the file to a file with
filename not containing space characters and then open the copied file
instead. BTW the 'plain out' file is a text file which gEdit opens OK.

-- 

John






More information about the User mailing list