File.cpp:148: error: expected primary-expression before ‘.’ token DIFFERENT SYMBOL
<p>I'm struggling to finish this code. </p>

<pre><code>#include (sorry but it won't show up the #include such as stdio.h AND OTHERS) But this is not the problem.


using namespace std;


struct CustomerFile {
    int arrivalTime;

    string driverfName,
        driverlName,
        typeOfDriver,
        driverLicNumber,
        vehicleMake,
        vehicleModel,
        Lot_taken,
        vehicleRegNumber,
        attendantName,
        ParkingArea,
        Comments,
        checkOutDateTime,
        checkInDateTime;
};

int arrivalTime;

string driverfName,

    driverlName,
    typeOfDriver,
    driverLicNumber,
    vehicleMake,
    vehicleModel,
    Lot_taken,
    vehicleRegNumber,
    attendantName,
    ParkingArea,
    Comments,
    checkOutDateTime,
    checkInDateTime;

int main(int argc, char * * argv) {

    FILE * cfPtr;

    if ((cfPtr = fopen("CustomerFile.dat", "rb+")) == NULL) {
        printf("file could not be opened");
    } else {
        printf("\nFile is Written to");
        printf("\nFile is open");

        printf("\n\n\nEnter Vehicle Registration Number: ");
        scanf("%s", &amp; CustomerFile.vehicleRegNumber);

        while (CustomerFile.vehicleRegNumber != 0) /*#IF THE USER does not enter 0 the loops should begin, but there is a problem here*/
        {

            printf("\nFirst Name: ");
            fscanf("%s", CustomerFile.driverfName); /*here is the problem, I think is had something to do with the struct name*/
            printf("\nLast Name:  ");
            printf("\nType of Driver:  ");
            printf("\nDriver's License Number:  ");
            printf("\nVehicle Make:  ");
            printf("\nVehicle Model:   ");
            printf("\nComments   ");
            printf("\nParking SpaceTaken ");

            printf("\n\nenter firstname, lastname");
            fscanf(stdin, "%s%s%s%s%s%s%s%s1f", CustomerFile.driverfName I think this has something to do with the statement * /
                                CustomerFile.driverlName   / * okay here * /
                                CustomerFile.typeOfDriver       / * okay here * /
                                CustomerFile.driverLicNumber         / * okay here * /
                                CustomerFile.vehicleMake      / * okay here * /
                                CustomerFile.vehicleModel       / * okay here * /
                                CustomerFile.Comments       / * okay here * /
                                &amp;CustomerFile.Lot_taken);       / * okay here * /


                        fwrite( sizeof(struct CustomerFile ), 1, cfPtr);




                }
                        fclose( cfPtr);
                }


return 0;

}
</code></pre>

<p>Okay the problem is that it keeps giving the errors;<em>*</em></p>

<blockquote>
  <p>File.cpp:144: error: expected primary-expression before ‘.’ token</p>
  
  <p>File.cpp:148: error: expected primary-expression before ‘.’ token</p>
  
  <p>File.cpp:162: error: expected primary-expression before ‘.’ token</p>
  
  <p>File.cpp:172: error: invalid conversion from ‘unsigned int’ to ‘const void*’</p>
  
  <p>File.cpp:172: error: invalid conversion from ‘FILE*’ to ‘size_t’
  /usr/include/stdio.h:708: error: too few arguments to function ‘size_t fwrite(const void*, size_t, size_t, FILE*)’
  File.cpp:172: error: at this point in file</p>
</blockquote>

<p>I believed or read that it has something with the fact that a C++ complier does not work with c99. If so, then how do you use structs in c++? I know you use a struct by just for example CustomerFile.driverlName, however, the complier keep refusing it. Also I'm having problems with the while loop. I'm familiar with c and c++ we were taught both c and c++, the code is to be written in c++ but the text book gives c code that won't run in a c++ complier.</p>
