Each time the program goes through a loop, nameField gets bigger and bigger. Strcat keeps adding new names to the field. How can I clear the field after each output? I thought it was something like nameField = {' '};...but that doesn't work. There has to be a simply way to clear everything from the nameField variable. I have spent way to much time trying to figure this out.

#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
using namespace std;
using std::ifstream;

void outputLine(char, char);

int main()
    struct date
        short year;
        short month;
        short day;

    date aDate;

    struct president
        char lastName [15];
        char firstName [19];
        date heldOfficeBeg;
        date heldOfficeEnd;
        date birthDate;
        date deathDate;
        char birthState[3];
        char buriedState[3];
        char married;
        char politicalParty[5];

    president presRecord;
    char nameField[45];

    ifstream inPresFile("\\Users\\Owner\\Documents\\presfile.dat",ios::in);

    if (!inPresFile)
        cout<<"File could not be opened"<<endl;

    for (int counter=1; counter < 40; counter++)
        inPresFile.read(reinterpret_cast<char *> (&presRecord),sizeof (presRecord));

        strcat (nameField,presRecord.firstName);
        strcat (nameField," ");
        strcat (nameField,presRecord.lastName);


        //nameField = {' '};
        system ("pause");

Try namefield[0] = '\0';

commented: Helped with homework. +2

Thank you, that did it. I should have asked a long time ago.