hello I'm trying to put together a guest registry program, and all
that i have left to do is put in a message/mail system where people
can leave small(3line)messages to other people....well i'm trying to
use structures and arrays to do this (i not very familiar with linked
lists)....but for some reason it won't work for me...does any one have
any ideas....this is what i'm trying to do..
structure for mail
struct pmail
{
char a[30];
char b[30];
char c[30];
char d[30];
char e[30];
Quote:
}
now for each mail box i want 10 of the pmail structures
struct mbox
{
struct pmail bmail[11]; i want the #0 array left blank.
Quote:
};
now i declare an example of pmail and mbox;
struct pmail umail[1];
struct mbox ubox;
i use printf & gets to gather the info and strore it in umail, then
strcpy each of the feilds into ubox.bmail[1](fields)...then save it to
file. then i fp=fopen("mail.dat","r+b");
fread(&ubox,sizeof(mbox),1,fp);
then i go through the process of gettting the data for
ubox.bmail[2].(feilds).......then fwrite(&ubox,sizeof(mbox),1,fp);
fclose(fp);
then i try to print out the arrays and ubox.bmail[1] will have
gibberish....and ubox.bmail[2] will have the data i stored there(well
to a certain extent)....any ideas....when i declare my instance of
mbox....should i give that array an element eg....mbox ubox[1];
thanks in advance
using Turbo C++ 3.0