I have to detect the end of line in a file tou count the number of comma separated strings in a line : I have a file which looks like this.
2,1,4,6,7
1,2,3,6,5
Now i have to count the the digits in a single line ignoring the comma. For eg the first line has 5 digits so does the second line. The no of digits can vary in each line. I used getline with comma delimeter. But then still i dont know when the line ends. The code ihave written will give me the count for whole file. All i want is a way to count the digits in a single line. How do i do it?


    numberofdigits =0;
    while(!friendsFile.eof()){
    		
    		getline(friendsFile,counts,',');
    	intcounts =	stoi(counts);
    	cout << intcounts;
    	numberofdigits++;
    	}

