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 / OpentoWrite and OpentoRead Need Help

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 22nd Aug 2016 18:57
Hi.

I want save my array value to a file and read it again but when I used below codes for write and read array value, it only save one value.

please guide me to fix it.

Thanks.

Write Array:



Read Array:

Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 22nd Aug 2016 19:24
I find it, I should use WriteLine and ReadLine.
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 23rd Aug 2016 07:31
Also move CloseFile to be called very last, outside the for-loop. And move OpenToWrite outside the for-loop before the for-loop. You only need to call these commands once. Right now, having them inside the for-loops, you are calling the commands 6 times each function call, also there is no way knowing that the file will write and be read the same way each time because you're opening than closing the file for each individual array line...very bad, very very bad. Example:



Good luck!
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 23rd Aug 2016 08:06
Thanks JLMoondog for your help.
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 23rd Aug 2016 13:20
No problemo!

Login to post a reply

Server time is: 2024-04-27 03:17:26
Your offset time is: 2024-04-27 03:17:26