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.

Newcomers DBPro Corner / File Exist Error

Author
Message
Alaror
13
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 27th May 2011 17:13
I'm working on some code that would load the player saved options (controls, window size, etc) using an array but have run into a bit of an issue with the file name. The first line of the code below returns an error saying that it could not determine the parameter type of playeroptions (the file name). Is the file name I'm using not formatted correctly, or is something else going on?



Oh and as an aside, I have already DIMed the array.
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 28th May 2011 01:47
I think the problem is that you either:
1. haven't specified a file format for the "playeroptions" file when you created it e.g .arr, .txt, .dat etc
2. you have simply forgotten to add the file format in that piece of code.

A clever person solves a problem, a wise person avoids it - Albert Einstein
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th May 2011 08:37
The FILE EXIST() command requires a string for the filename.



Alaror
13
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 28th May 2011 17:52
@Grog

Thanks, that was the problem.
Tom0001
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location:
Posted: 3rd Jun 2011 22:24
I don't know if it actually worked when you used just the filename, but you really should specify the filetype along with it always, just to be on the safe side, so it'd be "playeroptions.txt" instead of just "playeroptions".

What if you have two different file formats with the same name? I wonder which one DBP would load or if it would just throw up an error...hm. Might be worth a look. I thought without a filetype specification it would just throw up an error from the get-go, saying the file wasn't found?
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 4th Jun 2011 02:10
It works fine without an extension... Windows doesn't really care if you have an extension or not (maybe DOS but I remember making extensionless files in DOS too).

Login to post a reply

Server time is: 2024-11-22 22:44:17
Your offset time is: 2024-11-22 22:44:17