0

I have a .txt file with some info:

img

ifstream readfile(fileName);
if (readfile)
{
    readfile >> n;

    array = new Zakaz[n];
    for (int i = 0; i < n; i++)
    {
        readfile >> array[i].client.name;
        readfile >> array[i].client.tableNumber;
            
        getline(readfile, array[i].dish.nameOfDish);
        readfile >> array[i].client.fullDishQuantity;
        readfile >> array[i].dish.price;

        readfile >> array[i].time.hour;
        readfile >> array[i].time.minute;
    }

How can I read a full string with getline()?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Umlace
  • 1
  • 2

0 Answers0