Note that whitespace characters such as newlines and spaces are also counted. Text files are usually terminated with a newline (even if you cannot see it in a text editor). On Windows newlines normally consist of two characters (CR+LF), so don't be surprised if the loop doesn't give you any visible output.
The reason it fails is because when getline fails it will set the failbit (myfile.fail() == true) which will cause all read operations that follow (including tellg()) to automatically fail. In order to use the file like normally again you need to call clear() first.