Questions regarding File Reading, Newline characters, and FileReadToken
Displaying 1-10 of 10 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Omni

Does FileReadToken return a newline character?

Would it just be '\n' within the token?

Posted on 2005-04-06 18:06:34

Omni

Notes...

1. I tried my own demo, a list of 1's, such as


1
1
1
1


When in the following...


while(1)
Log('['+FileReadToken(file)+']');


This returned a list of 1's without any extra spaces or characters between the brackets, so I assume \n is ignored or discarded.



2. In the code above, how come this loop is infinite? Verge never quits with an EOF, it just keeps extending the list of ones. Does the file seeking cursor return to the start of the file?

EDIT: No, this is not the case. The cursor remains at the end of the file and keeps returning the last token. A list of
1 2

1 3
1 5
1 6
8
9


Returned a list of all numbers followed by an infinite list of 9's.

Posted on 2005-04-06 19:29:10 (last edited on 2005-04-06 19:31:48)

Omni

So, FileReadToken will not crash Verge at the end of a file. But, then there's no immediate way to determine how to reach the end of a file.

Possible solutions.

1. Read the file as a string and read tokens until you reach the end of the string. Unless I don't want to load the file into a string, in which case...

2. Mark the file with some tag as an ending token. Such as a final 'end' string at the end of the file.

OR

3. Preference. Use FileSeekPos() to find the end of the file, get the FileCurrentPos(), return to the beginning of the file, and then retrieve tokens while (FileCurrentPos < [ending position from seeking to the end]).

Are these fairly self-evident or can I put them into notes for the file functions?

Posted on 2005-04-06 19:38:03

vecna

I can't believe there's no FileEOF() function or something. Whoever wrote this verge thing is a real tool.

Posted on 2005-04-20 16:18:46

loretian

Quote:Originally posted by vecna

I can't believe there's no FileEOF() function or something. Whoever wrote this verge thing is a real tool.


Not to mention perverted.

Posted on 2005-04-20 20:02:02

mcgrue

I heard that verge was written by the devil to punish mankind for being extra bad!

Posted on 2005-04-22 15:56:11

CrazyAznGamer

I'm so confused... ;_;
I thought that the person who made VERGE was...

(x_x)
<==========|=


Ahem... this transmission has been interrupted by the devil. I would just like to tell all of you that I, indeed, have written VERGE.

Posted on 2005-04-25 17:19:00

mcgrue

CrazyAznGamer, I am not sure if you are a Gamer, and I have no proof that you are Azn, but I am in agreement with at least a one-third minority of your name.

Posted on 2005-04-25 18:04:03

Gayo

Quote:Originally posted by vecna

I can't believe there's no FileEOF() function or something. Whoever wrote this verge thing is a real tool.


I hear that'll be added in the next build, along with negative numbers in source code, multiple obstruction layers, diagonal movescripts, and the tooth fairy.

Posted on 2005-04-27 05:05:14

Interference22

Quote:Originally posted by Gayo

Quote:Originally posted by vecna

I can't believe there's no FileEOF() function or something. Whoever wrote this verge thing is a real tool.


I hear that'll be added in the next build, along with negative numbers in source code, multiple obstruction layers, diagonal movescripts, and the tooth fairy.


What he said.

Posted on 2005-04-27 11:17:53


Displaying 1-10 of 10 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.