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)
|