Author Topic: [not a problem] READ_2DA_ENTRY doesn't work on very large files  (Read 550 times)

Offline K4thos

  • Planewalker
  • *****
  • Posts: 110
As title suggest weidu can't read text from the end of file via READ_2DA_ENTRY if the file is very large. You can test it with this TRA file (TLK converted to TRA):
https://www.sendspace.com/file/fmxmbs

and this test code:
Code: [Select]
COPY - ~bg2ee_ENG.tra~ ~bg2ee_ENG.tra~
COUNT_2DA_ROWS 3 "cnt_row"
READ_2DA_ENTRY cnt_row 0 3 "cutoff"
PATCH_PRINT ~cutoff = %cutoff%, cnt_row = %cnt_row%~
I'm currently using workaround for this problem, so it's not really very important to me, but I'm wondering if the file size limit for this command is a bug or limitation that can't be bypassed. It the latter than is it known what is the exact size limit?

edit: unless I've made a mistake in above test code something is weird. I've just tried this test code on the same file and this time weidu was able to print the last string correctly:
Code: [Select]
COPY - ~bg2ee_ENG.tra~ ~bg2ee_ENG.tra~
SPRINT cutoff ~dummy~
COUNT_2DA_ROWS 3 "cnt_row"
WHILE (~%cutoff%~ STRING_CONTAINS_REGEXP ~^@[0-9]+~) BEGIN //not StrRef
READ_2DA_ENTRY cnt_row 0 3 "cutoff"
SET cnt_row = cnt_row - 1
END
PATCH_PRINT ~cutoff = %cutoff%, cnt_row = %cnt_row%~

edit2: yep, the first test code was faulty. This one works:
Code: [Select]
COPY - ~bg2ee_ENG.tra~ ~bg2ee_ENG.tra~
COUNT_2DA_ROWS 3 "cnt_row"
READ_2DA_ENTRY (cnt_row - 1) 0 3 "cutoff"
PATCH_PRINT ~cutoff = %cutoff%, cnt_row = %cnt_row%~
Not sure why weidu could read that last empty line without error though.
« Last Edit: August 25, 2015, 09:54:03 AM by K4thos »

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: