|
-
Nov 22nd, 2002, 08:44 AM
#1
Thread Starter
Hyperactive Member
What is a byte array?
Hi,
I'm working with some applications that require data to be passed as a byte array. I'm getting them to work without really understanding what's going on.
Simply, what is a byte array and how is it different from simple binary data?
Thanks,
Al.
A computer is a tool, not a toy.
-
Nov 22nd, 2002, 08:57 AM
#2
PowerPoster
all data in computers is binary, the question is how it is organized. Byte just means 8 bits (actually that's NOT what it means, but that useage is so pervasive in today's computer arena that you'll even find it in glossaries, so use it as a working definition). Integer means either 16 bits or 32 bits depending on the processor. Other data types organize bits into chunks of varying sizes from one bit to dozens of bits, that are organized and interpreted according to arbitrary, but perfectly useable, schemes.
-
Nov 22nd, 2002, 09:01 AM
#3
Lively Member
Byte variables are stored as single, unsigned, 8-bit (1-byte) numbers ranging in value from 0–255.
The Bytedata type is useful for containing binary data.
This is what it says in MSDN...
-
Nov 22nd, 2002, 09:32 AM
#4
Fanatic Member
Here's an example of a byte in action:
VB Code:
Option Explicit
Dim GameWinner As Byte 'This is used to determine if we have a winner of a game is.
Dim Rounds As Integer 'This is used to determine how many rounds have been played.
Private Sub DetermineGameWinner()
If txtPlayer1.Text > txtPlayer2.Text And txtPlayer1.Text > txtPlayer3.Text Then
GameWinner = 1 '1 indicates a win
MsgBox "Player 1 wins!"
ElseIf txtPlayer2.Text > txtPlayer1.Text And txtPlayer2.Text > txtPlayer3.Text Then
GameWinner = 1
MsgBox "Player 2 wins!"
'Use ElseIf with txtPlayer3.Text also.
ElseIf txtPlayer1.Text = txtPlayer2.Text And txtPlayer1.Text = txtPlayer3.Text Then
GameWinner = 0 '0 indicates a tie.
MsgBox "The game is a draw."
End If
'Put this whereever you need it.
If Rounds = 10 Then
DetermineGameWinner
End If
End Sub
Hope this helps.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|