Problems with reading last line of file
Code:
// Match stats - MainCode:
The code above is supposed to read the last line of a file (the last match's id) from a file and increment the id for this match. Or if there are no matches in the file, then make the match number = 0. The problem: Right now 'stats_match_number' will not increment past 1... Any help would be appreciated...Thanks! *EDIT* Nevermind O:)...Figured out that write_file writes and extra newline/linefeed to the file, so the file line should be: "file_size(stats_file_main, 1) - 2", instead of: "file_size(stats_file_main, 1) - 1" |
Re: Problems with reading last line of file
you should use the new file natives, they are much mo betta
|
Re: Problems with reading last line of file
i use allway this to read every line of file:
Code:
new fsize = file_size(filename,1) |
Re: Problems with reading last line of file
Quote:
|
Re: Problems with reading last line of file
not only better but it is MUCH faster, with read file everytime you call it, it opens a new file handle and seeks from the start of the file. With the new natives you open the file handle and then just progress through the file using the same handle.
|
| All times are GMT -4. The time now is 08:01. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.