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 AppGameKit Corner / File IO returns Integers Wrong

Author
Message
gamergod88
8
Years of Service
User Offline
Joined: 28th Apr 2016
Location:
Posted: 25th Sep 2016 12:48 Edited at: 26th Sep 2016 07:56
Here is what it should put out:


Here is what it actually puts out:

Attachments

Login to view attachments
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 25th Sep 2016 14:39
You need to elaborate more, with a code sample. Reading integers works fine, maybe your pointer is out of sync by reading/writing a wrong data type.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
gamergod88
8
Years of Service
User Offline
Joined: 28th Apr 2016
Location:
Posted: 26th Sep 2016 01:19
Here you go.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 26th Sep 2016 02:37 Edited at: 26th Sep 2016 02:37
you need to attach the x.txt file as well
gamergod88
8
Years of Service
User Offline
Joined: 28th Apr 2016
Location:
Posted: 26th Sep 2016 07:19
Here you go.

Attachments

Login to view attachments
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 26th Sep 2016 08:27
Your file doesn't contain integers, it contains text.
If it was a file of integers, you would see a meaningless string of characters.

To solve your problem you need to use:

x[b]=val(ReadLine(1))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
gamergod88
8
Years of Service
User Offline
Joined: 28th Apr 2016
Location:
Posted: 26th Sep 2016 10:26
Thanks! Works like a charm.
gamergod88
8
Years of Service
User Offline
Joined: 28th Apr 2016
Location:
Posted: 26th Sep 2016 10:46 Edited at: 26th Sep 2016 10:48
I have one further question.
How could I write several random integers to a text file?

I tried with:


That doesn't work though.

The text file is just a blank text file with the name "myfile.txt"

When I run the code above, close the program, and open the text file its empty.
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 26th Sep 2016 12:40
When writing files in AGK2, they are by default placed in your "C:\Users\YOUR WINDOWS USERNAME\AppData\local\AGKApps\YOUR APP NAME\media\", if you are on Windows, that is.
13/0
sokiu
8
Years of Service
User Offline
Joined: 4th Oct 2016
Location:
Posted: 4th Oct 2016 08:17
you need to attach txt

Login to post a reply

Server time is: 2024-11-22 02:27:31
Your offset time is: 2024-11-22 02:27:31