Are you just counting the lines or what are you trying to do? was dumb question.
Also, I believe you need to open the file again though you could try seekg. Since you just read in everything from the file then try to read in again an arbitrary number of lines to get to line x.
return phrase; - this looks like an error, since char phrase[256]; is a local variable which will go out of scope when the function terminates, thus trying to access it afterwards will not work.
It might be better to change the function to return a std::string instead.
Thank you a lot! That's seems a lot better! But i never used vectors.
Is there really that much difference between arrays other that methods?
Because modifing your code for an array seems simple...
The advantage of the vector is it can dynamically resize as required. if you tried to use a array, you'd be back where you were before with a need to first read the entire file in order to determine the array size, and allocate it with sufficient size, then you'd need to read it all again to populate the array. That adds more work.
In other respects, a vector can often be considered as a direct replacement for an array, it can be used with the same array[index] syntax which keeps things simple.