How do you repeat a pattern until the end of a file? #1467
-
I was writing this Pattern and i was wondering if i can make the number of events in the struct DataSection dynamic so that it always stops at the end of the file, and doesn't overshoot (which would cause an error). Im a noob so if im asking a dumb question let me know. #pragma description "FLP File Structure" struct Header { struct Event { struct DataSection { struct FLPFile { FLPFile flpfile @0x00000000; |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Event events[while(!std::mem::eof())] [[comment("Array of events")]]; make sure to also #include "std/mem.pat" |
Beta Was this translation helpful? Give feedback.
make sure to also #include "std/mem.pat"
If you prefer you can do a similar construct to use size and read only so many bytes. Left as exercise to reader but will post the answer if requested. (hint: use $ to calculate the number of bytes read so far).