fileapi.h
Re: fileapi.h
Code: Select all
dir.s="C:\MyDir"
Debug RemoveDirectory_(@dir)
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Re: fileapi.h
The link points to RemoveDirectoryA()
'A' means an ASCII string is required.
So ...
But the 'A' version is not directly available in PB.
You have to import it.
And why not DeleteDirectory()
'A' means an ASCII string is required.
So ...
Code: Select all
*Ascii = Ascii("c:\MyDir")
RemoveDirectoryA_(*Ascii)
FreeMemory(*Ascii)
You have to import it.
And why not DeleteDirectory()
Re: fileapi.h
Thank you
Writing code without pointer is wrong ?
Writing code without pointer is wrong ?
Code: Select all
Procedure.l MyCreateDirectory()
Protected.l out
Protected.s mydir = GetUserDirectory(#PB_Directory_Desktop)+"test"
out=CreateDirectory_(mydir, #NUL)
If out=0
th_errcode=GetLastError_()
EndIf
ProcedureReturn out
EndProcedure
Procedure.l MyRemoveDirectory()
Protected.l out
Protected.s mydir = GetUserDirectory(#PB_Directory_Desktop)+"test"
out=RemoveDirectory_(mydir)
If out=0
th_errcode=GetLastError_()
EndIf
ProcedureReturn out
EndProcedure
MyCreateDirectory()
Delay (2000)
MyRemoveDirectory()
Re: fileapi.h
Code: Select all
dir.s="X:\MyDir"
r1 = RemoveDirectory_(@dir)
Code: Select all
; r1 = RemoveDirectory_(@dir)
MOV rax,qword [v_dir]
MOV rcx,rax
CALL RemoveDirectoryW
MOV qword [v_r1],rax
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: fileapi.h
RemoveDirectory_() automatically uses RemoveDirectoryW_() if you use it in PB.
And you can use the variable without @, because when it is defined as string, the variable itself is a pointer to the string location.
But you can also use @ in front. It is no error and sometimes it makes it more clear what is meant.
This has nothing to do with API.
If I need the address I use @a(0),
So I see always that I want the address of element 0.
And you can use the variable without @, because when it is defined as string, the variable itself is a pointer to the string location.
But you can also use @ in front. It is no error and sometimes it makes it more clear what is meant.
This has nothing to do with API.
Code: Select all
Dim a(2)
Debug a()
Debug @a()
Debug @a(0)
; But ...
Debug @a(1)
So I see always that I want the address of element 0.
Re: fileapi.h
I know, that's why I wanted to tell the correct way.infratec wrote: ↑Sat Jul 02, 2022 7:45 pm The link points to RemoveDirectoryA()
'A' means an ASCII string is required.
So ...But the 'A' version is not directly available in PB.Code: Select all
*Ascii = Ascii("c:\MyDir") RemoveDirectoryA_(*Ascii) FreeMemory(*Ascii)
You have to import it.
And why not DeleteDirectory()
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Re: fileapi.h
thank you all for the help