Edit Anything

Professional text and hex editing
with Binary Templates technology.






SweetScape Knowledgebase
KB1027: Can I read data from a file without defining a template variable?

When defining a variable in a template, you can test the value of that variable to determine how to parse the file (reading the value of the variable will read data from your file). For example:

    int tagType;
    if( tagType > 5 )
    {
        ...
    }

In this example comparing 'tagType' reads data from the disk. Sometimes it is necessary to read data from a file before defining a template variable. This type of reading can be done with the ReadByte, ReadUByte, ReadShort, ReadInt, ReadUInt, etc. functions. These functions require a read position to be passed to them, which is usually just the value returned by the 'FTell' function. For example, this code reads data from a file without defining a variable:

    if( ReadInt(FTell()) > 5 )
    {
        ...
    }


Back to knowledgebase index
Back to main support page



Our Products


Latest News


Download
- 010 Editor
v8.0
is now available.

Download it now!
What's New in 8.0?


Newsletter
Join our newsletter to receive tips and tricks on hex editing, special offers, and news from SweetScape Software Inc.

Sign-up Now...