Restored from previous forum. Originally posted by lanael.
FileExists( Filename$ )
Test if a file exists
return 1 if found, 0 otherwise.
Milliseconds()
Return the number of milliseconds since the computer starts
( I think every OS has it )
/* don't believe, just think */
[Implemented] 2 simple & useful functions needed
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Justin.
This is my version of fileexist, there are other alternatives.
This is my version of fileexist, there are other alternatives.
Code: Select all
#HFILE_ERROR=-1
sof.OFSTRUCT
global sof
;test if a file exists
;Returns: true if exists, false otherwise
procedure fileexist(file$)
if OpenFile_(file$,@sof,#OF_EXIST)=#HFILE_ERROR
procedurereturn 0
else
procedurereturn 1
endif
endprocedure
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Pupil.
You can also use the command FileSize() to check if a file exist or not. The command returns -1 if file doesn't exist and -2 if the filename you've provided is a directory name..
example:
If you want the milliseconds elapsed since computer was turned on you can use this:
You can also use the command FileSize() to check if a file exist or not. The command returns -1 if file doesn't exist and -2 if the filename you've provided is a directory name..
example:
Code: Select all
If FileSize(filename$) = -1
; File doesn't exist
EndIf
Code: Select all
msecs.l = GetTickCount_() ; Win OS only
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
http://www.allapi.net
Best Regards
Ricardo
Dont cry for me Argentina...
Windows API'_'-suffixed functions (kind of low-level ?? )
http://www.allapi.net
Best Regards
Ricardo
Dont cry for me Argentina...