Announcement

Collapse
No announcement yet.

Can't DIR$ handle spaces in filenames?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can't DIR$ handle spaces in filenames?

    I guess not, since
    Code:
    dim a as string, temp as string
    a = "c:\Program Files\*.*"
    temp = DIR$(a)
    returns an empty string...
    Kind regards
    Eddy


    ------------------
    [email protected]

    [This message has been edited by Eddy Van Esch (edited August 22, 2001).]
    Eddy

  • #2
    Eddy

    That's strange, because I'm using DIR$ to populate a combo box drop
    list and it's working fine for me. The code is as follows.

    Code:
    CALL Combo_ResetContent (tb_hWndCombo)
     
    f$ = DIR$( File_Dir$ + "*." + ExtPart$(File_Name$) )
    WHILE LEN(f$) > 0
      CALL Combo_AddString(tb_hWndCombo, f$)
      f$ = DIR$
    WEND
    The only difference I could see is that my File_Dir$ is uppercase
    (eg. C:\PROGRAM FILES\MYAPP\) but I don't imagine that would make
    a difference.

    Keith


    Keith


    ------------------

    Comment


    • #3
      Eddy,

      Since "C:\Program Files" contains subdirs, no files, you should specify the directory attribute in the DIR$ command, like this:
      Code:
      temp$ = DIR$("C:\Program Files\*.*", 16)
      ------------------
      mailto:[email protected][email protected]</A>
      www.basicguru.com/zijlema/

      Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
      http://zijlema.basicguru.eu
      *** Opinions expressed here are not necessarily untrue ***

      Comment


      • #4
        Egbert

        Well spotted. Of course, if Eddy is looking for sub-directories
        that's true. If he wants files, he must specify the particular
        sub-directory.

        Keith

        ------------------

        Comment


        • #5
          Guys,
          I found the problem!
          1) First my example:
          a = "c:\Program Files\*.*"
          temp = DIR$(a)
          The reason this didn't work was because there where indeed files there, but they
          where hidden! Egberts tip DIR$("C:\Program Files\*.*", 16) worked.
          After I copied a non-hidden files into that directory it also worked without
          the ",16"-mask.

          2) Now my actual problem because the above was meant as a simple example:
          In my program I searched for example for files named like this:
          Code:
          "G:\copy of sortingunitframe2\anglesupport.asm.*"
          Because some of the file names contain spaces, I thought I had to put double
          quotes around the file name (chr$(34)) before feeding them to the DIR$-function!!!
          I just found out that this is not the case, it is just the opposite:
          seems that DIR$ chokes on the double quotes...!!
          I must say that I have Win2K..God knows it might be different on Win9x systems...
          Anyway, problem solved and thanks a million for your instant help!!!!
          Kind regards
          Eddy


          ------------------
          [email protected]

          [This message has been edited by Eddy Van Esch (edited August 22, 2001).]
          Eddy

          Comment

          Working...
          X