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 / Problems with writeFile()

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Apr 2013 19:20 Edited at: 24th Apr 2013 19:25
This crashes for me:


However, adding 0 for the 'optional' append parameter then it doesn't crash, even though that parameter is said to be 0 by default.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Apr 2013 19:32 Edited at: 24th Apr 2013 19:34
What version are you working with?

EDIT: Never mind, it crashes in v1076. Please report this as bug in the google issue list and I'll confirm it.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Apr 2013 20:31
i remember me the docu was wrong, default was append.
now i use it with ,0 for overwrite.
can you delete the file manual and try again?
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Apr 2013 21:07 Edited at: 24th Apr 2013 21:08
Even though the documentation is wrong about the default (and that should be included in the bug report), the app does crash if you don't provide it with either a zero or one.

EDIT: If you are testing on your Windows computer, go to Documents/AGK/<yourappname>/media and manually delete the file. And there is a DeleteFile command for use within the app.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Apr 2013 23:04 Edited at: 24th Apr 2013 23:11
Quote: "What version are you working with?"

v108 beta 11

Quote: "can you delete the file manual and try again?"

Yes I can delete the file, but it'll still crash whether or not the file is exists. Basically, it only works if I specify that parameter.



Well this is quite bizarre. I created the file using 0 as the overwrite parameter (file did not exist at this point). It created the text document as expected with the proper text. I then ran the same snippet only this time I set parameter to 1 to append to the file. Oh it appended the line of text alright, but it also changed the character encoding! Here's my output when I appended the text to the already existing file:

桔⁥楢⁧瑳灵摩搠杯爠湡椠瑮⁡慷汬!桔⁥楢⁧瑳灵摩搠杯爠湡椠瑮⁡慷汬!

In case you can't see the characters, it's all japanese. I haven't reported this part as a bug yet, because this only appears to open in japanese for me in notepad. Wordpad, Word, or Notepad++ displays the text fine.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Apr 2013 23:08
hmmm, did you copy unicode text in source code?
don't know what happens, just a idea.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Apr 2013 23:12
Just updated my post with an additional note. It only appears to display in japanese with Notepad only, and only after I've appended text to it.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 24th Apr 2013 23:16
Can you post the actual file? I spend my days dealing with things like this!

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Apr 2013 23:23
Keep in mind that WriteString is outputting for a binary file. If you want a file that is human readable/editable, you use WriteLine.

For text files, you'll need to convert all your numbers to strings.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 26th Apr 2013 00:38
Fixed the crash and the default setting for OpenToWrite for next beta. The Japanese I have no idea, but maybe this will also be fixed.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 26th Apr 2013 18:00
Quote: "The Japanese I have no idea, but maybe this will also be fixed."

I think that was related to using WriteString instead of WriteLine.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-11-24 11:47:47
Your offset time is: 2024-11-24 11:47:47