I programming in C++ on linux. I am trying to read 1 line of data from an input file and store it in a string. There are no spaces anywhere on the line. Because I had issues using a string and getline, I used a char array to store line when it is read in and then I created a new string by passing the char array into the string's constructor. The data in the string is grouped in sets of 3 characters, so I get the length of the string using str.length() and divide the length by 3 to get the number of sets in the string. For testing purposes, I am writing length of the string and the number of character sets to stdout. When I test with a file that has 16 character sets, I get the correct output. But when I test with a file that has 49 character sets, I am getting the wrong output. Instead of getting a string length of 147 and 49 sets, I am getting a string length of 161 and 53 sets. Somehow the string length is being returned as larger than it should be. Does anyone have any suggestions as to how to fix this problem? Is there a way that I can use a c++ string instead of a char array to read the line from the input file? Thanks.