123456
char* c2; for(char& c1 : str) { c2 = &c1; textbuf->append(c2); textbuf->append("Between"); }
123456789101112131415161718192021
#include <iostream> #include <string> int main() { std::string examString("EXAM"); std::string betweenString("between"); std::string newLine(""); for (char c1 : examString) { std::string charStr(1,c1); newLine += charStr + betweenString; } std::cout << newLine; return 0; }