|
|
| Post Number: 1
|
dginley 

Group: Members
Posts: 3
Joined: Feb. 2005
Member Rating: None
|
 |
Posted on: Dec. 18 2008,16:18 |
|
 |
I'm using version 3.1 and trying to build a template for a file of binary data, but with an xml header at the beginning of the file. The binary part is simple, but I'm having trouble with the header: 1) the length of the header is unknown, so I can't just read a given number of lines, and 2) every line of the header except the last is terminated with a crlf, so I can't just read lines that way, as is done in the template tutorial.
The header is of the format <StorageToolkt> many lines of data </StorageToolkt>binary date begins here
As I said above, the </StorageToolkt> line does not have a crlf at its end; the very next byte is the beginning of the data. It seems that I should be able to use the string "</StorageToolkt>" to stop reading the header, but when I try that I read one byte too many. Am I missing something obvious here?
Thanks for any suggestions, Dennis
|
 |
|
|
| Post Number: 2
|
andrew 

Group: Super Administrators
Posts: 635
Joined: Oct. 2003
Member Rating: 4
|
 |
Posted on: Dec. 21 2008,02:34 |
|
 |
If you use a string in a template and don't specify a length then the string continues until EOF or a string terminator is encountered. By default the string terminator is a nul (00) byte but you can set it to any byte value even '>'.
You should also try using 3.3 as there have been some bug fixes for templates.
-------------- Andrew Phillips Moderator of Forums and creator of Hex Edit
|
 |
|
|
| Post Number: 3
|
dginley 

Group: Members
Posts: 3
Joined: Feb. 2005
Member Rating: None
|
 |
Posted on: Jan. 05 2009,10:07 |
|
 |
Thanks for the reply, Andrew.
Using '>' as the string terminator works for the individual strings, but then the question becomes how to stop the FOR loop. I'm assuming a FOR loop is the way to go, since I need to read an unknown number of strings in the header before I get to the data.
If I try thisHeaderline == "</StorageToolkit>"" I get the message Illegal operand types for comparison in "stop_test" of "for"
If I try it without the quotes, i.e. thisHeaderline == </StorageToolkit> the message is Unexpected characters "</" in "stop_test" of "for"
I've tried several other things, but I'm not getting anywhere.
Thanks, Dennis
|
 |
|
|
| Post Number: 4
|
|
|
|
|
|