Hi FRANK,
FRANK MASINGILL was observed on 08-Oct-97, writing to ALL
Something about: Error showing data
FM> Either there is some error I'm stupidly overlooking or some quirk in
FM> this program code. If I took out all references to the fifth item
FM> Many thanks in advance. I know my face will be red when I learn why.
That is a possibility
FM> //DATABASE.CPP - playing with char data items
FM> char state[2];
FM> char zip[10];
You did not allocate enough space for the terminating nul.
In memory the zip code comes right after the state...
SS33333-3333
You could store the characters with out the nul, but you
must realize that you are not working with a string. I
think it would be easiest for you to use strings and just
make the arrays longer. Remember, a string is a nul term-
inated character array.
I would leave more room for the city also. If you consider
the longest probable input : District of Columbia
you need at least 21 characters. IMHO, 36 chars is usually
good for names. Probably wouldn't hurt to go more for the
address line too... soooo... I would go with something like
this...
private:
char name[36];
char address[48];
char city[24];
char state[3];
char zip[11];
Roger Scudder
rscudder@usa.net
... Those who refuse to learn from the past are condemned to repeat it.
--- Terminate 5.00/Pro
* TerMail/QWK * Terminate does both QWK offline-mail and fido-mail!
---------------
* Origin: Fidonet * Storm Front BBS (215)788-4662 v.34+ (1:273/60)
|