| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Help with Ra |
PE> JL> struct LCrecord { unsigned char Line; unsigned char Name[36];
PE> JL> unsigned char Handle[36];
PE> Can you post a 10-line (not 100-line!!!) program, which does the
PE> following:
PE> opens the file.
PE> reads a single record
PE> prints the Name (only).
PE> ends
Yup, but only because i have got the strings working properly .. hows this?
(actually quite simplified -- the structures i changed .. main problem)
[---]
#include
#include
struct lastcall {
unsigned char Line;
unsigned char Name_Length;
unsigned char Name[35];
unsigned char Handle_Length;
unsigned char Handle[35];
unsigned char City_Length;
unsigned char City[26];
unsigned int Baud;
long Times;
unsigned char Logon[5];
unsigned char Logoff_Length;
unsigned char Logoff[5];
unsigned char Attribute;
};
struct lastcall lcall;
char name[35];
FILE *lc;
void main(void)
{
lc = fopen("c:\\ra\\lastcall.bbs", "rb");
while((fread(&lcall, sizeof(lcall), 1, lc)) != 0){
strncpy(l_name, lcall.Name, 35);
l_name[lcall.Name_Length] = '\0';
printf("%s\n\r", l_name);
};
fclose(lc);
}
[---]
Sorry about the length :), but this SHOULD actually work ..
(the real source reads in the environment, writes to a file etc etc)
NOW, my problem NOW is i don't know how to handle the ;
long Times; and
unsigned int Baud;
Since i can simply copy the others as strings as they are char's, i try to
print the above as decimal, string, integer (and so on) and i get
rediculous numbers (like 11231 for baud rate) or (null) ... can you help
there at all?
Maybe the strucutures i have aren't working well with the baud and times called?
Cheers!, Jahmai.
@NOTE: IceEdit 1.60 [Eval]
--- GEcho 1.00
* Origin: Abduction BBS -- We DON'T Deliver! -- +61-63-72-6855 (3:623/682)SEEN-BY: 50/99 78/0 620/243 623/353 411 624 630 631 682 683 689 812 711/401 SEEN-BY: 711/409 410 413 430 808 809 932 934 712/515 713/888 714/906 800/1 SEEN-BY: 7877/2809 @PATH: 623/682 624 812 630 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™.