01 Nov 95 11:49, James Goldbloom escrib¡a a All:
Hola James!
JG> My question is, being I am not experienced with how to translate
JG> structures into actual code (knowing if the file is binary, how to use
[...]
JG> BoardRecord = record (* MSGCFG.DAT *)
JG> Name : String[40];
JG> Typ : TypeMsgs;
[...]
1) You must translate this Pascal structure to the Basic format, using the
properly types. The type may looks like this:
Type BoardRecordType
UserName as STRING * 40
Typ as TypeMsgs
[...]
End Type
Note that 'TypeMsgs' and others are other structures, and you must declare
they first. If the Pascal structure have bitfield fields you may translate it
using a WORD and use it in your code with the PowerBASIC 'BIT' function.
Boolean type may be tranlated by a BYTE type.
[...]
JG> Spare : Array[4..12] of Byte;
JG> end;
Here is the problem, PowerBASIC types not support arrays inside they. You
can declare 'Spare' as a fixed len string array of 8 chars, and the use each
one with the function 'MID$'
To read the boards file and insert the records in a array you can do
something like this:
-----------------------====---------------------------------
Dim ThisRecord as BoardRecordType
Dim TotalRecs as INTEGER
Dim Counter as INTEGER
Open "XXXXX.RA" for binary as #1
TotalRecs=Lof(1)/Len(ThisRecord)
Dim Huge Records(1:TotalRecs) as BoardRecordType
Do While TotalRecs
Get #1,,ThisRecord
Records(Counter)=ThisRecord
Incr Counter
Decr TotalRecs
Loop
-----------------------====---------------------------------
Then Array Sort or whatever you want. That code may works on PowerBASIC 3.10
and over. Ops! 'Array sort' don't works with huge arrays!
JG> These are public structures to a file used by my BBS software which I
JG> want to write a utility for, and my utility will open the message base
JG> config file, for sorting, etc.
Remote Access ?
JG> Can someone here post an English layman's explanation of what major
I don't known what is the meaning of 'English layma's' but I hope that you
understan my brief explanation.
Saludotes,
,,,
`0-0' JOS (2:348/102)
/-(_)-\ mejuto@sfdzuma.usc.es
--- FD2.12+ & GoldED 2.50+ & FE145+
---------------
* Origin: -=EDI=BBS=-// Santiago de Compostela //+34-81-502110 (2:348/102)
|