Hey people I am having an issue with structs and hopeing someone could help me out...
The code i have writen is as follows....
Code:::
#include <iostream.h>
#include <fstream.h>
#include <string.h>
struct name
{
char firstname[15];
char middleinitial[3];
char lastname[15];
};
name fullname;
struct listing
{
name fullname;
char title[31];
char phone[15];
char officenum[11];
};
listing entry;
int main()
{
// Define local variables
name firstname[15];
name middleinitial[3];
name lastname[15];
listing title [31];
listing phone[15];
listing officenum;
char end_condition;
// Read in from file
ifstream in;
in.open ("direct.dat");
in.get (entry.fullname.firstname, 15, ';');
in.get ();
in.get (entry.fullname.middleinitial, 3, ';');
in.get ();
in.get (entry.fullname.lastname, 15, ';');
in.get ();
in.get (entry.title, 31, ';');
in.get ();
in.get (entry.phone, 15, ';');
in.get ()
in.get (entry.officenum, 11, '\n');
in.get ();
:::Code
The problem i am haveing right now is with the last 3 in.get where im trying to put data into the title, phone, and officenum. for some reason i cant even compile with those as they are.
I dont know if im calling to the struct variables properly... im jsut confused because i have the top 3 working right... and i thought i had the form the same.
also, one other quick question about structs... can i take a struct (that is created via user input) and export the entire struct to a file?
any help will be most welcome!!!!!