User | Post |
Sokarhacd
Posts: 158/1757 |
now your just replying to a thread that was a reply to a bump so now it will keep going on forever.
this was probably the most pointless post ever lol |
Gavin
Posts: 53/799 |
Originally posted by Chaosflare woah, your not supposed to bump old threads, this one was a month old, but and coby probably already solved this problem from HH's post.
at least it wasn't a worthless reply to a post that bumped a thread. it actually offered infor-fucking-mation.
and at least it wasn't the reply of a reply to a bump... |
Sokarhacd
Posts: 156/1757 |
woah, your not supposed to bump old threads, this one was a month old, but and coby probably already solved this problem from HH's post. |
macai
Posts: 3/4 |
Another method you could use is to open the entire file into memory and then scan through it until you reaxch the FF FF point that you desire to stop at, and then ReDim Preserve the byte array into what it should be. For example..
Public Function FileUntil |
HyperLamer
Posts: 354/8210 |
A loop of course.
Dim Byte1 as Byte, Byte2 as Byte, ArrayCount as Long
ArrayCount = LBound(Bytes) 'Get the first # in the array Do 'Variable names are assumed here, and I imagine you already opened the file Get #nFileNum, Offset, Byte1 Get #nFileNum, Offset, Byte2 Bytes(ArrayCount) = Byte1 Bytes(ArrayCount + 1) = Byte2 ArrayCount = ArrayCount + 2 If ArrayCount > UBound(Bytes) Then 'If the counter's gone past the last entry MsgBox "Too many bytes!" Exit Do End If DoEvents 'Windoze will think your program's crashed if it doesn't do this after a while (it's done automatically when not in a loop) Loop Until (Byte1 = 255) And (Byte2 = 255) 'The brackets aren't necessary but it's best to make sure things stay in the right place, on the off chance it might think "Byte1 = (255 AND Byte2) = 255" which is, surprisingly a valid statement (If 255 AND Byte2 = 255, Byte1 = 1, Else Byte1 = 0)
This of course will copy the FF FF into the array too, if you don't want that, add "If (Byte1 = 255) And (Byte2 = 255) Then Exit Do" above the line "Bytes(ArrayCount) = Byte1". |
Darth Coby
Posts: 473/1371 |
Say I'd want to load from a certain offset until I reach a certain byte (FF FF in this case, I know they're two bytes though. ) How would I make it load every byte into the byte array until it reaches FF FF? |