> Anyone know how to read a Pascal data file and convert the file
> structure to PB? The first data byte of a string is usually the length
> of the string, and I'm supposing that numeric variables don't contain a
> string length.
> An example would be appreciated.
> Thanks.
Below is an example.
-- Doug
UlRec = RECORD
Name : STRING[39];
Filename : STRING[8];
DlPathname,
UlPathName : STRING[30];
Password : STRING[15];
Flags : UlRecFlagSet; 'UlRecFlagSet is a set of 8 bits
DSL,
SeeNames : BYTE;
ArLvl : ArFlagType;
NoRatioGroupNum : BYTE;
END;
Type UlRec
aName AS STRING * 40
Filename AS STRING *9
DlPathname AS STRING * 31
UlPathName AS STRING * 31
Password AS STRING * 16
Flags AS BYTE
DSL AS BYTE
SeeNames AS BYTE
ArLvl AS STRING * 1
NoRatioGroupNum AS BYTE
END;
'ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
'³ FUNCTION: TP2PB$ ³ Converts a Pascal string to a PowerBasic ³
'³ ³ string. ³
'ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
'
' TPString$ = Turbo Pascal string to convert
' MaxLen = Max Lenght of the returned PowerBasic string.
'
Function TP2PB$ (TPString$, MaxLen as Byte) PUBLIC as string
If ASCII(TPStirng$) > MaxLen Then
TP2PB$=Mid$(TPString$,2,MaxLen)
Else
TP2PB$ =Mid$(TPString$,2,ASCII(TPString$))
End If
End Function
'ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
'³ FUNCTION: PB2TP$ ³ Converts a PowerBasic string to a ³
'³ ³ Pascal string ³
'ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
'
' PBString$ = PowerBasic string to convert.
' MaxLen = Max Lenght of the returned Turbo Pascal string.
'
Function PB2TP$ (PBString$, MaxLen as byte) PUBLIC
If Len(PBString$) > MaxLen Then 'If String is longer then MaxLen then
PBString$ = Left$(PBString$,MaxLen)
End if
'Now convert the string to Pascal format.
PB2TP$= CHR$(LEN(PBString$)) + PBString$
End Function
--- GEcho 1.20/Pro
---------------
* Origin: * The War Zone * Wayne, Mi (313)467-9950 (1:2410/805)
|