I am trying to compile the following code, and I keep getting parse errors. Can someone please tell me what these errors are, and what may be wrong with my code that I am getting them.
Thanks for reading.Code:#include <iostream> #include <fstream> #include <cassert> using namespace std; const int size = 100; typedef struct Region { int code; char name_township[60]; char name_state[20]; char name_county[20]; }; int read_regions(Region records[], char filename); int main(int argc, char *argv[]) { if(argc !=3) { cout << "This program needs 2 command line arguments" << endl; exit(0); } Region township_data[size]; if(argv[3] == "township.dat") read_regions(Region township_data[size], argv[3]); else read_regions(Region township_data[size], argv[2]); } int read_regions(Region records[], char filename) { ifstream infile; infile.open("filename", ios::in | ios::binary); assert(infile); infile.read(records, sizeof(records)); infile.close(); return 1; }



LinkBack URL
About LinkBacks


