pointer help!

I created a record type program that keeps the record of multiple patients in seperate files, these records include full name and other details. It goes something like this

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <fstream>
using namespace std;
ofstream outputfile;
ifstream infile;
char fullname[40],otherdetails[60];
int main()
{
outputfile.open("record1");
outputfile<<fullname<<endl
<<otherdetails<<endl;
return 0;
}

Now there will be multiple record files for each patient, I need to group them together into one large single record, how do i group the fullname,otherdetails etc. into one pointer and do this for every file? i tried adding them together ex.
char record1=(*fullname)+(*otherdetails)
but it did not work, the program says it cannot change from char* to char[40] etc.
Last edited on
Maybe something like this:
1
2
char* record1 = fullname;
record1+40 = otherdetails;


A good way to keep things together like you are saying is to use a struct:
1
2
3
4
5
struct record
{
    char fullname[40];
    char otherdetails[60];
};


Now you can do something like:
record MyRecords[25]; to keep track of 25 patients.
Topic archived. No new replies allowed.