In VB6, how do you convert long and integer values into a single byte.
For example, if I use the string
11913ACE215Ace Electronics
Where 119 = length,
1 = index,
3 = lenth of data to follow
ACE = Data
2 = index
15 = length of data
...
To produce the format:
[BYTE][BYTE][BYTE]ACE[BYTE][BYTE]Ace Electronics
similar to (not sure if this will show)
DataData
I have tried a methods such as
1)
2)
However, Neither of these methods seem to make any difference to the output.
I think I might be missing something. My current output still shows the numberic values (11913...), however I need to display a single byte for each numeric value.
For example, if I use the string
11913ACE215Ace Electronics
Where 119 = length,
1 = index,
3 = lenth of data to follow
ACE = Data
2 = index
15 = length of data
...
To produce the format:
[BYTE][BYTE][BYTE]ACE[BYTE][BYTE]Ace Electronics
similar to (not sure if this will show)
DataData
I have tried a methods such as
1)
Code:
Dim myFSO As New FileSystemObject
Dim OS As TextStream
Dim Str As String, by() As Byte
Str = "17Cust-01"
by = StrConv(Str, vbFromUnicode)
Set OS = myFSO.CreateTextFile("C:\Projects\Test.DAT")
For i = 1 To UBound(by)
OS.Write by(i)
Next i
Code:
Dim Str As String
Dim CharArray() As Byte
Dim i As Integer
Str = "My test string"
ReDim CharArray(Len(Str))
For i = 1 To Len(Str)
CharArray(i) = Asc(Mid$(Str, i, 1))
Next i
However, Neither of these methods seem to make any difference to the output.
I think I might be missing something. My current output still shows the numberic values (11913...), however I need to display a single byte for each numeric value.