TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Jahmai Lay
from: Peter Collis
date: 1996-05-03 11:34:40
subject: Help with Ra

While listening to Jahmai Lay Pete heard:Help with Ra

G'day Jahmai

 JL> Hello all, I have the C structures for Remote Access, am using
 JL> QuickC and was wondering if anyone could help me with using the
 JL> structures to get the data, i get the general idea but the data
 JL> i get is usually garbled, mainly after the first entry ... EG

 JL> Jahmai Lay
 JL> Ahmai Lay SDFsd9usats
 JL> Ylsa asdsadfsa

 JL> Like so, same with Time, Baud etc etc, ... could someone give me
 JL> a CLEAN example of how to copy the strings from a file using the
 JL> following structures ;

Just a guess but try putting '#pragma pack(1)' before the structure
and '#pragma pack()' after, this will tell the compiler to byte align
the structure. see below

#pragma pack(1)

 JL> struct LCrecord {
 JL> unsigned char Line; <----------
 JL> unsigned char Name[36];       |
 JL> unsigned char Handle[36];     |
 JL> unsigned char City[26];       | Without the pack() pragma
 JL> unsigned int  Baud;           | these will be padded out to
 JL> long          Times;          | a word boundary
 JL> unsigned char LogOn[6],       |
 JL> LogOff[6];                    |
 JL> unsigned char Attribute;  <----
 JL> };

#pragma pack()

 JL> I then Open the file, declare some strings that i copy info to
 JL> etc etc and using a While loop with FREAD, I read sequential
 JL> data and strncpy or strcpy the records, is this correct?  If so
 JL> could someone please indicate any problems .. a proper example
 JL> would be greatly appreciated.

i'm not sure i understand you, are you reading into a string then
copying to a record, why not just

   struct LCrecord rec;

/* Fhndl is a FILE* and is already open */

   fread(&rec, sizeof(rec), 1, Fhndl);

   -=Pete=-


 
--- OMX/Blue Wave v2.12
* Origin: Gates of Hell (3:713/914.16)
SEEN-BY: 50/99 78/0 620/243 623/630 711/401 409 410 413 430 808 809 932 934
SEEN-BY: 712/508 515 713/111 317 601 611 615 618 700 826 888 914 714/906
SEEN-BY: 800/1 7877/2809
@PATH: 713/914 615 888 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

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™.