I want to show how many lines in afile

suppose a file has two lines there are

i am shoukhin
i live in Bangladesh


and my program shows 2.
please give a solution
Well you could just open the file and read it line by line with getline, incrementing some line count each time. However, this is fairly inefficient and it is apparently quicker to read the whole file in one go and parse it in memory.
Topic archived. No new replies allowed.