Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

VISUAL BASIC IS THE BEST

Name: Anonymous 2007-02-19 12:27

Sub ConvertRecord(ByRef B() As Byte, RecordStart As Long, S As Worksheet, T As Worksheet, CurRow As Long)

    Dim V As Variant
    Dim CurCol As Long
    Dim ColumnType As String
    Dim Pointer As Long
   
    CurCol = 1
    Do
        ColumnType = S.Cells(CurCol + 1, 2).Value
        If ColumnType = "" Then
            Exit Sub
        End If
        Pointer = RecordStart + S.Cells(CurCol + 1, 7).Value
        Select Case ColumnType
            Case "DECIMAL":
                V = ConvertDecimal(B, Pointer, S.Cells(CurCol + 1, 4).Value, S.Cells(CurCol + 1, 5))
            Case "CHAR":
                V = ConvertString(B, Pointer, S.Cells(CurCol + 1, 3).Value)
            Case "SMALLINT":
                V = ConvertSmallInt(B, Pointer)
            Case Else:
                V = CVErr(xlErrNA)
        End Select
        T.Cells(CurRow, CurCol).Value = V
        CurCol = CurCol + 1
    Loop Until False

End Sub

Function ConvertDecimal(ByRef B() As Byte, Pointer As Long, Precision As Long, DScale As Long) As Double

    Dim n As Long
    Dim L As Long
    Dim Multiplier As Double
   
    L = (Precision + 1) / 2
    Multiplier = 10 ^ (Precision - DScale - 1)
    ConvertDecimal = 0
   
    For n = 0 To L - 1
        ConvertDecimal = ConvertDecimal + (B(Pointer + n) \ 16) * Multiplier
        Multiplier = Multiplier / 10
        If (n = L - 1) Then
            ' sign nibble
            If B(Pointer + n) Mod 16 = &HD Then
                ConvertDecimal = -ConvertDecimal
            End If
        Else
            ConvertDecimal = ConvertDecimal + (B(Pointer + n) Mod 16) * Multiplier
            Multiplier = Multiplier / 10
        End If
    Next n
   
End Function

Function ConvertString(ByRef B() As Byte, Pointer As Long, Size As Long) As String

    Dim n As Long
    For n = 0 To Size - 1
        ConvertString = ConvertString + Chr(B(Pointer + n))
    Next
   
End Function

Function ConvertSmallInt(ByRef B() As Byte, Pointer As Long) As Integer
   
    ConvertSmallInt = B(Pointer) + B(Pointer + 1) * 256
   
End Function

Name: !S4gE.X84OA 2007-02-19 12:32 (sage)

tru.dat (nah, just kiddin')

Name: !hax? 2007-02-19 13:03 (sage)

oic

Name: Anonymous 2007-02-19 19:38

One word. no line delimiters. Thread over.

Name: Anonymous 2007-02-19 21:08

GTFO IM AN EXPERT PROGRAMMER

Name: Anonymous 2007-02-20 10:11

Dim LongCat as Long

Name: Anonymous 2007-02-20 12:37

free(LongCat);

Name: Anonymous 2007-02-20 12:57

>>4

Line _
 continuation _
 over many _
 lines

Multiple Statements : On One Line : Separated By Colons

Name: Anonymous 2007-02-20 13:49

(WRYYYYYYY (YYYYYYY (YYYYYYYYYY)))

Name: JustAnotherAnonymousUser 2007-02-22 2:20 ID:qUmktAyH

struct LongCat
{
char name[15]
int head = 1;
int arms = 2;
int body = INT_MAX;
int legs = 2;
int tail = 1;
};

LongCat lives on...

Name: JustAnotherAnonymousUser 2007-02-22 2:24 ID:qUmktAyH

cout << "I forgot a semicolon on my LongCat struct's data member :( \n";

Name: Anonymous 2009-01-14 14:08

WHBT

Name: Anonymous 2010-06-25 14:52

WARNING: NECRO POST

Name: ​​​​​​​​​​ 2010-10-24 10:25

Name: Anonymous 2010-11-27 2:16

Name: Anonymous 2011-02-03 0:16

Name: Anonymous 2011-02-03 1:42

Name: Sgt.Kabu쿔kimanꀭ횫 2012-05-28 22:47

Bringing /prog/ back to its people

Don't change these.
Name: Email:
Entire Thread Thread List