Include win32api.inc if using an old compiler.
Added DIR$ CLOSE
REM 64-bit Windows 7 system folder not supported
Added DIR$ CLOSE
REM 64-bit Windows 7 system folder not supported
Code:
FUNCTION PBFileSize(BYVAL sFile AS STRING) AS QUAD [B]REM 64-bit Windows 7 system folder not supported[/B] LOCAL Udt AS DIRDATA 'DIRDATA built into PowerBASIC sFile = DIR$ (sfile TO Udt) 'fill structure DIR$ CLOSE 'Michael Mattias IF LEN(sFile) THEN 'file found FUNCTION = MAK(QUAD, Udt.FileSizeLow , Udt.FileSizeHigh)'make quad ELSE FUNCTION = -53 'not found, return error -53 END IF END FUNCTION FUNCTION PBMAIN AS LONG LOCAL sFile AS STRING LOCAL qSize AS QUAD sFile = "c:\windows\system32\mrt.exe" qSize = PBFileSize(sFile) ? USING$("#,",qSize) END FUNCTION
Comment