file I/O troubles

This code should prompt input for 5 fields and then write them put them into an array and write to a file. I get an error message when I close the file, anyone see the problem? [side note, the "TheScreen" is what appears with the info entered in, it is not aprt of the problem.]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
void addNewCustomer(){
     fstream CustomerFile;
     CustomerFile.open("database_file.txt");
     int maxCustomerNumber;
     maxCustomerNumber = 1; 
     customerDataBase customerArray[maxCustomerNumber];
     TheScreen(customerArray[k]);
     cout<<endl<<"please enter last name: ";
     cin>>customerArray[k].lastName;
     CustomerFile<<customerArray[k].lastName<<",";
     system ("cls");
     TheScreen(customerArray[k]);
     cout<<endl<<"please enter first name: ";
     cin>>customerArray[k].firstName;
     CustomerFile<<customerArray[k].firstName<<",";
     system ("cls");
     TheScreen(customerArray[k]);
     cout<<endl<<"please address name: ";
     cin>>customerArray[k].addr1;
     CustomerFile<<customerArray[k].addr1<<",";
     system ("cls");
     TheScreen(customerArray[k]);
     cout<<endl<<"please other address information name: ";
     cin>>customerArray[k].addr2;
     CustomerFile<<customerArray[k].addr2<<",";
     system ("cls");
     TheScreen(customerArray[k]);
     cout<<endl<<"please enter e-mail name: ";
     cin>>customerArray[k].eMail;
     CustomerFile<<customerArray[k].eMail<<",";
     system ("cls");
     TheScreen(customerArray[k]); 
     CustomerFile.close; 
}     
Close is function, so it should be CustomerFile.close();
Topic archived. No new replies allowed.