| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Reading Pascal files |
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. * WCE 2.1G1/2081 * --- InterEcho 1.18 --------------- ** A related thread FOLLOWS this message. FIDO MESSAGE AREA==> TOPIC: 214 POWER BASIC Ref: DAYI0488 Date: 06/29/96 From: KURT KUZBA Time: 02:08pm \/To: LAWRENCE GORDON (Read 6 times) Subj: R: Reading Pascal files LG> Anyone know how to read a Pascal data file and convert the LG> file structure to PB? The first data byte of a string is LG> usually the length of the string, and I'm supposing that LG> numeric variables don't contain a string length. LG> An example would be appreciated. lg>........................................................... You just have to read it into an appropriately sized string. The conversion must be performed before using the string data and before writing it back to the file. To convert the string to PB format from Pascal: string$ = mid$(string$, 2, asc(string$)) To convert the string to Pascal format from PB: string$ = chr$(len(rtrim$(string$))) + string$ Some people favor using a separate data field for the length. type PascalUserStruct UNamLen as string * 1 UNam as string * 16 end type Since you still need to trim the string using the UNamLen variable and set UNamLen varaible before writing the data to the file, however, I favor the standard string method, with the explicit conversion routine shown above. --- > ]* Origin: Toast House * (314) 994-0312 * (1:100/560) * Origin: [Team QuickBBS] [Team OmegaSoft] [PB Fanatic!] (FIDONET 1:109/611) |
|
| SOURCE: echomail via exec-pc | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.