Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: chucklas on Thu 24/07/2014 00:59:32

Title: Catching errors when readin ints from file
Post by: chucklas on Thu 24/07/2014 00:59:32
I am curious if it is possible to catch errors when reading ints from a file.  I have a file where i save the time played.  If someone tries to edit the file and then play the game, it causes the came to crash when reading the time played back from the file.  If possible i would like to just delete the file if there is an error when reading the ints instead of having the game crash.  I can't find anyway to do this.  Is it possible or am I just out of luck?
Title: Re: Catching errors when readin ints from file
Post by: Khris on Thu 24/07/2014 02:09:52
You don't have to rely on AGS's file int functions, you can write and read raw characters.
Just make up your own format, best using some simple encryption. Then read it back and parse it yourself.
Title: Re: Catching errors when readin ints from file
Post by: chucklas on Thu 24/07/2014 12:31:12
yeah, fair enough.  I was hoping to have some type of try/catch but I totally understand not implementing that in ags.