Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - Byte Arrays... [VB] | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
Darth Coby Vire Dacht je nou echt dat het over was? Dacht je nou echt dat ik gebroken was? Nee toch? Nou kijk eens goed op uit je ogen gast. zonder clic heb je geen kloten tjap... bitch Level: 55 Posts: 473/1371 EXP: 1240774 For next: 73415 Since: 03-15-04 From: Belgium Since last post: 2 days Last activity: 9 hours |
| ||
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? | |||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 354/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
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". |
|||
macai Newcomer Level: 4 Posts: 3/4 EXP: 185 For next: 94 Since: 05-12-04 Since last post: 528 days Last activity: 339 days |
| ||
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 (edited by macai on 05-11-04 08:08 PM) |
|||
Sokarhacd Ball and Chain Trooper Resistance is Futile You Will Be Assimilated Hab SoSlI' Quch Level: 61 Posts: 156/1757 EXP: 1799888 For next: 76708 Since: 03-15-04 Since last post: 6 days Last activity: 4 hours |
| ||
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. | |||
Gavin Fuzzy Rhinoceruses don't play games. They fucking charge your ass. Level: 43 Posts: 53/799 EXP: 551711 For next: 13335 Since: 03-15-04 From: IL, USA Since last post: 13 hours Last activity: 13 hours |
| ||
Originally posted by Chaosflare 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 Ball and Chain Trooper Resistance is Futile You Will Be Assimilated Hab SoSlI' Quch Level: 61 Posts: 158/1757 EXP: 1799888 For next: 76708 Since: 03-15-04 Since last post: 6 days Last activity: 4 hours |
| ||
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 |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - Byte Arrays... [VB] | | | |