I am attempting to read a .txt file. I am tasked with using only:
   #include <iostream>
I must use redirect.
Multiple lines of data, such as:
AddItem 3 1 1 4 7.75 7.62 0.69 0.025 4.97 2 0 8
exist in the file.
I need to read in the "AddItem" as a Char array, and the values as ints and doubles. Here is my code.
#include <iostream>
using namespace std;
void emptyString(char* x, int size) {
   for (int i = 0; i < size; i++)
       x[i] = '\0';
}
int main() {
    char command[10];
    int quantity, code, brand, type, option, option2;
    double height, length, width, weight, price;
    while (!cin.eof()) {// while end of file is not reached
        emptyString(command, 10);
        cin >> command 
        >> quantity 
        >> code 
        >> brand 
        >> height 
        >> length
        >> width
        >> weight
        >> price
        >> type
        >> option
        >> option2;
    
    if (!cin.eof()) {
        cout << command << ", "
            << quantity << ", "
            << code << ", "
            << brand << ", "
            << height << ", "
            << length << ", "
            << width << ", "
            << weight << ", "
            << price << ", "
            << type << ", "
            << option << ", "
            << option2 << ", "
            << endl;
        }
    }
    return 0;
}
When I run the file it never ends. ctrl+z is supposed to stop it, but that does nothing for me in Visual Studio 2015.

 
     
    