Page 1 of 1

Posted: Mon Jul 29, 2002 8:11 am
by BackupUser
Restored from previous forum. Originally posted by cor.

Manual says:

Result = FileSize(FileName$)
Description

Returns the size of the specified file.

Special 'Result' values:

-1: File not found.
-2: File is a directory

Filesize returns always -1 whether the file exists or not exists

Code: Select all

 
; Get app's directory.
appdir$=Space(255)
GetCurrentDirectory_(255,appdir$) 
If Right(appdir$,1)  "\" 
  appdir$=appdir$+"\" 
EndIf

;Check if chorddef.dat exists
return=FileSize(appdir$+"chorddef.dat")
MessageRequester("",str(return),0)

Using Windows 98 SE
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com

Posted: Mon Jul 29, 2002 8:28 am
by BackupUser
Restored from previous forum. Originally posted by PB.

> Filesize returns always -1 whether the file exists or not exists

Your example works fine for me. Are you 100% sure that "chorddef.dat" exists?

Also, I wouldn't use "return" as a variable name because that's a PureBasic
keyword... so use another name. Also, make sure you don't have a procedure
named "FileSize" in your code either (just in case).

PB - Registered PureBasic Coder

Edited by - PB on 29 July 2002 09:29:49

Posted: Mon Jul 29, 2002 9:29 am
by BackupUser
Restored from previous forum. Originally posted by cor.

Thanks PB,

It's working now

I had double extensions chordplanet.dat.txt

Using Windows 98 SE
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com