Can you tell us what the errors are that you are getting?
Also I would consider doing your main loop differently. At the moment you will add a record to your array even if the read fails or reaches the end of file. I would consider something like this:
1 2 3 4 5 6 7 8 9
inFile.open(fileName.c_str());
Diamond d; // input value
while(inFile >> d.stockNumber >> d.cut >> d.color >> d.clarity >> d.carats >> d.cost)
{
// now we know that the read was a success so we can safely add our data
diamondData[totalData] = d;
++totalData;
}
Also I am concerned that there is no bounds checking on your array. I would seriously consider using a std::vector instead: