I am trying to read a data (*.txt) file of records separated by commas (,).
I would like to read each line up to the comma and separate the fields into variables for comarison.
Here is a sample line:
Here is my code to process the line:
The problem is Windows continuosly issues an error message and says the program must be closed.
//open the imageFile again with the character path argument
char c; //current character
char line = ""; //buffer for each line
char * linePtr = &line; //point the pointer to the beginning of line
char field = ""; //buffer for each field
char * fieldPtr = &field; //point to the beginning of field
//read in the line
while(municIn.getline(line, 400, '\n'))
//read characters up to ','
while( (c = municIn.get()) != ',' )
//add the character to the field
*fieldPtr = c;
//cap off the field
fieldPtr = '\0';
fieldPtr = &field;
cout << field << endl;
} //end while line in
What am I doing wrong?