Announcement

Collapse
No announcement yet.

Problem with IsFile

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

  • Problem with IsFile

    Hello All !

    The function
    " FileExists& = ISFILE(FILENAME$) "
    - (as example shown in PBCC help) does not work.
    It causes compiling error: DefType, TypeId os AS requiered: ISFILE

    What am i doing wrong ?

    Thanks for help.

    Karl
    Karl

  • #2
    Are you sure that you're compiling using PBCC 5 ?

    Also, FILENAME$ is a reserved keyword so I assume that you are replacing that "variable" with a different one or a literal (i.e. sFilename$, "temp.bas", etc...).

    IsFile works correctly for me on PBWIN 9.
    Paul Squires
    FireFly Visual Designer (for PowerBASIC Windows 10+)
    Version 3 now available.
    http://www.planetsquires.com

    Comment


    • #3
      Don't use FILENAME$. It is now a built-in function.
      Forum: http://www.jose.it-berater.org/smfforum/index.php

      Comment


      • #4
        Hello Paul , hello Jose !

        FileExists& = ISFILE(TEST$) also does not work
        Version of PBCC is: 5.00.0085

        Karl
        Karl

        Comment


        • #5
          This compiles

          Code:
          #COMPILE EXE
          
          FUNCTION PBMAIN () AS LONG
          
             FileExists& = ISFILE(TEST$)
             WAITKEY$
          
          END FUNCTION
          There must be something else.
          Forum: http://www.jose.it-berater.org/smfforum/index.php

          Comment


          • #6
            Yes compiles
            but this code failes:

            #COMPILE EXE
            #DIM ALL


            FUNCTION PBMAIN () AS LONG

            FileExists& = ISFILE(TEST$)
            WAITKEY$


            END FUNCTION

            Why ?
            Karl

            Comment


            • #7
              Karl, if you are using PwrDev you can use: VD_IO_IsFolderOrFile(...)
              hellobasic

              Comment


              • #8
                :laugh:

                Oh yeah !

                I love PwrDev !
                (The best ever )

                Thanks Edwin !

                Should have read the manual of PwrDev before posting ...

                Karl
                Karl

                Comment


                • #9
                  Originally posted by José Roca View Post
                  This compiles

                  Code:
                  #COMPILE EXE
                  
                  FUNCTION PBMAIN () AS LONG
                  
                     FileExists& = ISFILE(TEST$)
                     WAITKEY$
                  
                  END FUNCTION
                  There must be something else.
                  Where do you define Test$ ?
                  This code is running fine here ...

                  Code:
                  #COMPILE EXE
                  
                  FUNCTION PBMAIN () AS LONG
                     test$ = "c:\test\xyz.txt"
                     FileExists& = ISFILE(TEST$)
                     ? FileExists, IsFile(test$)
                     WAITKEY$
                  
                  END FUNCTION
                  Regards,
                  Hubert

                  ------------------------------------
                  http://familie-brandel.de/index_e.html

                  Comment


                  • #10
                    Sorry I quoted the wrong message :-(

                    Originally posted by Karl Skergeth View Post
                    Yes compiles
                    but this code failes:

                    #COMPILE EXE
                    #DIM ALL


                    FUNCTION PBMAIN () AS LONG

                    FileExists& = ISFILE(TEST$)
                    WAITKEY$


                    END FUNCTION

                    Why ?
                    with #DIM ALL - wich is very usefull to provide misstyping of variables, you have to use LOCAL, STATIC or GLOBAL statements for each variable ...

                    Code:
                    #COMPILE EXE
                    #DIM ALL 
                    
                    
                    FUNCTION PBMAIN () AS LONG
                       local test as string
                       local FileExists as long
                       test = "..."
                       FileExists = ISFILE(TEST)
                       WAITKEY$
                    
                    
                    END FUNCTION
                    Regards,
                    Hubert

                    ------------------------------------
                    http://familie-brandel.de/index_e.html

                    Comment


                    • #11
                      Thanks !
                      Karl
                      Karl

                      Comment

                      Working...
                      X