Ok, the code above seemed not to work until line 11 was changed to
while(fin.good()).
Probably I needed to modify something in a simple way but I am not familiar at all with <fstream> ( I should say with C++ in general...)
Anyway, I think the code now works just fine now with this little modification.
I wanted to do a little extra thing which is to count the number of lines in that same file opened via fstream. I tried using the function gcount i.e. adding a line which says
fin.gcount()
just before the return 0; command. However, when I display fin.gcount by "cout" command, it displays 0, even though the number of lines is definitely not zero.
How can I count how many lines were read (or better, how many values are assigned to the vectors a and b in the code above)??