I'm getting a path (e.g. pics\temp.pcx) out of 1 line within a file (models\temp.md2).
However, the file is not pure text, so FileRead only gets to the second line and produces an error.
Is there a way to convert this file to pure text?
-Stu
Searching through a file
10 posts
FileReadByte doesn't care if the input is text or not, so you can use it to process the file.
It's just outputting a load of numbers.
I need to get a line out of the file and search for ".pcx" in it
I just need to get hold of a line of text from it now...
-Stu
I need to get a line out of the file and search for ".pcx" in it
I just need to get hold of a line of text from it now...
-Stu
Use:
IntFmt $0 "%c" $1
where $1 is the output of FileReadByte and you'll get the character read in $0. It's up to you to find out how to skip the non text part of the file, FileReadByte will read anything.
IntFmt $0 "%c" $1
where $1 is the output of FileReadByte and you'll get the character read in $0. It's up to you to find out how to skip the non text part of the file, FileReadByte will read anything.
I shall look
-Stu
-Stu
[edit]heh, ok 🙂[/edit]
Then the byte read is a character that can not be displayed on screen, maybe 0. As I've said, it's up to you to tell where the text you want begins. Use FileReadByte to skip the parts you don't want, or can't read.
Then the byte read is a character that can not be displayed on screen, maybe 0. As I've said, it's up to you to tell where the text you want begins. Use FileReadByte to skip the parts you don't want, or can't read.
Ok, so I have tried to collect up 20 characters, and then search for .pcx in that:
loop_read:
ClearErrors
FileReadByte $R2 $R3
IfErrors error
IntFmt $R3 "%c" $R3
IntOp $R5 $R5 + 1
StrCpy $R4 $R4$R3
StrCmp $R5 20 0 loop_read
But $R4 comes out as only about 4 characters long.
What have I done wrong?
-Stu
loop_read:
ClearErrors
FileReadByte $R2 $R3
IfErrors error
IntFmt $R3 "%c" $R3
IntOp $R5 $R5 + 1
StrCpy $R4 $R4$R3
StrCmp $R5 20 0 loop_read
But $R4 comes out as only about 4 characters long.
What have I done wrong?
-Stu
Ok, It's not outputting spaces. At least I am getting part of the ".pc" in it!
-Stu 🙂
-Stu 🙂
Here's what I made..
edited by kichik, attached below.
Works great on both md2 and sp2 files 🙂
-Stu
edited by kichik, attached below.
Works great on both md2 and sp2 files 🙂
-Stu
Please attach large scripts.