Where and how to get CWAPI module to call MkDir()

Hello !
Can anyone point me as to where and how to get CWAPI module (dll ?)

Thanks !
Mario

That’s a bit of a generic question, what Clarion version do you have and exactly what are you trying to do?
There’s a .H file that lists the Clarion functions you can call from C code, but it’s unlikely you want that.

Clarion 10.
Want to make use of MkDir

Just add INCLUDE(‘CLIB.CLW’) into the global map and use MkDir.

An alternative would be to use the Windows API Function.

CreateDirectory  PROCEDURE(*CSTRING lpPathName, |
                            LONG pSecurityAttributes=0 |  !Pass Zero for default security 
                          ),BOOL,RAW,PASCAL,DLL(1),PROC,name('CreateDirectoryA')  !Failed Returns Zero
GetLastError (),LONG,PASCAL,DLL(1)

ERROR_PATH_NOT_FOUND             EQUATE(3)
ERROR_ALREADY_EXISTS             EQUATE(183)

I’m not sure how you get error information from MkDir(). With CreateDirectory() if it fails it returns Zero, then you call GetLastError(). It is documented to return 2 errors, but others are possible. Note if the folder exists you do get an Error 183 so beaware. You may want to check for EXISTS() before.

image

IIRC there may be a Shell API function that will do a Deep MkDir, i.e. make any intermediate directories that do not exist. Found SHCreateDirectory but it may be obsolete.

2 Likes

Not sure i have clib.clw…

Look in libsrc folder.

How to declare mkdir() in MAP:

  MAP
    ...
    MODULE('')
      MkDir (CONST *CSTRING),SIGNED,PROC,NAME('_mkdir')
    END
  END
1 Like