Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / GetFilesize() ?

Author
Message
LittlePIC
12
Years of Service
User Offline
Joined: 19th Oct 2011
Location:
Posted: 9th Sep 2013 07:10 Edited at: 9th Sep 2013 07:15
Is any one else having issues with the 'getfilesize' function? Not sure why I cant get the bytes returned? Message displays the file name correctly and checks the file exists and is opened but still returns 'o' bytes?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 9th Sep 2013 09:04
strange, maybe a bug.
i get also 0 byte at windows pc with beta 19
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 9th Sep 2013 11:05
Does it not only work with OpenToRead files? I use it in my media loading all the time and it seems to be ok with beta 19.

JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 9th Sep 2013 11:22
If you open a new file to write it will be zero bytes. I'm note sure what the report is if it has content.

-- Jim - When is there going to be a release?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 9th Sep 2013 13:12 Edited at: 9th Sep 2013 13:12
i tryed opentoread also,it shows me 0 byte.
i saw that opentowrite did nothing until some command write in the file. so i expect it should show me the size from the text file i had created manually.
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 9th Sep 2013 14:17 Edited at: 9th Sep 2013 14:20
I see from my debug log that the file size doesn't change until the file is closed, so it not working with OpenToWrite isn't overly surprising. (I've never used the append mode when writing a file, but I suspect it would stay at the original size until the file is closed)

I definitely have had it working with OpenToRead files though, on Windows 7, 8 and Android (Both compiled into APK and through the player.)

I just tested the OP's code snippet, and in it's current state it does report 0 as the size of the file; but try it with OpenToRead(str2$) instead and assuming the file you point it to has size, it reports the size correctly.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 9th Sep 2013 21:04
i get =0 !?
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 9th Sep 2013 22:20
@Markus:
Did you just make an empty text file? They have 0 bytes. I did that when I first tested the snippet above.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 10th Sep 2013 08:42
@=PRoF=
no, i input some chars.
it contains 18 bytes "sdfsdfsdfsdfsdfsdf"
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 10th Sep 2013 19:40
This is weird, It is working for me. I just wrote a quick test program of my own which writes a file, gets the size, then opens it to read and gets the size, and BOTH times it reports the size of the file correctly.

This was tested under Windows 7 Home Premium 64bit, and Android 4.2.2; using code written and compiled with AppGameKit 1.08 beta 19

Both platforms returned correct values for both tests.



Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 10th Sep 2013 22:02
@=PRoF=
maybe there is something missing for windows 8 i did use.
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 10th Sep 2013 22:21 Edited at: 11th Sep 2013 00:11
@Markus:
This is really weird :/

I have used the GetFileSize() command successfully in my Media loading functions to verify media files (as there is no sensible way to hash a file in tier 1 as yet) for a long time now. It has always worked for me on Android and Windows Vista, 7 and 8.

I have no idea why it's not working for you or the OP.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 11th Sep 2013 01:31 Edited at: 11th Sep 2013 01:37
the reason is the file extension^^
.txt don't work but .dat

(i wrote a issue in the google list)
LittlePIC
12
Years of Service
User Offline
Joined: 19th Oct 2011
Location:
Posted: 11th Sep 2013 04:28
Hi All,

Worked out my problem was a permissions settings under the user account.
Sorry Markus, I cant either reproduce your fault or offer a solution
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 11th Sep 2013 09:04
@LittlePIC
then we have two ways the get size 0 from this command
i don't need this command. i did just make a small test
and got the same result like you.

Login to post a reply

Server time is: 2024-05-03 06:29:48
Your offset time is: 2024-05-03 06:29:48