TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Jahmai Lay
from: Paul Edwards
date: 1996-05-01 07:21:12
subject: Help with Ra

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

JL> Yup, but only because i have got the strings working properly .. hows this?
JL> (actually quite simplified -- the structures i changed .. main problem)

Ok, well I actually want code that doesn't work, so this is of
no use!

JL>        unsigned char City[26];
JL>        unsigned int  Baud;
JL>        long          Times;
JL>        unsigned char Logon[5];
JL>        unsigned char Logoff_Length;
JL>        unsigned char Logoff[5];
JL>        unsigned char Attribute;
JL>        };

JL> void main(void)

Where did you pick this up from?  It should be "int main(void)".

JL> Sorry about the length :), but this SHOULD actually work ..
JL> (the real source reads in the environment, writes to a file etc etc)

JL> NOW, my problem NOW is i don't know how to handle the ;
JL> long  Times;  and
JL> unsigned int Baud;

JL> Since i can simply copy the others as strings as they are char's, i try to 
JL> print the above as decimal, string, integer (and so on) and i get 
JL> rediculous numbers (like 11231 for baud rate) or (null) ... can you help 
JL> there at all? Maybe the strucutures i have aren't working well with the baud 
JL> and times called?

There are a number of possibilities:

1. Your structures aren't packed
2. The integers are in the wrong order for your machine
3. You are not printing them out correctly

Does your program above print out the name of the person for TWO
records fine?  If so, your structures are packed properly.  It is
highly unlikely that the integers are in the wrong order, because
it is likely that it is intel-format data, and you are running on
an intel machine.  You could be printing it out incorrectly, you
need "%u" not "%d" for unsigned integer.  BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

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