-2
while (!fin.eof())
{
    getline(fin,line);
    stringstream s(line);
    
    while (getline(s, word, ','))
    {
        row.push_back(word);
    }

    if (RowFound(row))
    {
        fin << "Pass";
    }
}

The problem is that the word "Pass" is deleting chars from next line,
so my question is how can I move the cursor to beginning of line?

Dominique
  • 16,450
  • 15
  • 56
  • 112
batsheva
  • 1
  • 2
  • You also have [`tellg`](https://en.cppreference.com/w/cpp/io/basic_istream/tellg) and [`seekg`](https://en.cppreference.com/w/cpp/io/basic_istream/seekg) – Ted Lyngmo Aug 10 '21 at 11:25
  • 2
    Fyi, standard warning: [`while (!fin.eof())` is nearly always wrong](https://stackoverflow.com/questions/5605125/why-is-iostreameof-inside-a-loop-condition-i-e-while-stream-eof-cons) – WhozCraig Aug 10 '21 at 11:47

1 Answers1

-1

You can store the current position of the file using tellg(), and then go back to that position using seekg(...)

Details here

Ted Lyngmo
  • 93,841
  • 5
  • 60
  • 108
ShahzadIftikhar
  • 515
  • 2
  • 11
  • I'd be careful about linking to geekforgeeks. The example they provide uses `#include ` which is not a standard header file. – Ted Lyngmo Aug 10 '21 at 11:34