After the above all the characters are in the std::string line. Why would you want to copy them to a character array? You don't need a loop to do that, just this one line. But there is rarely any reason to do it.