string printing issues

Nov 11, 2012 at 12:58am
I loaded a string using the format

str = "string"
for(int i = 0; i<str.end(); i++)
new_str[i] = str[i];

however when I go to print, the new string only prints the first char however it does hold all the chars from the original string. This is even the case when NULL is appended to the new string.
For example:

cout << string;
output -> "string"

cout << new_str;
output -> "s"






Last edited on Nov 11, 2012 at 1:02am
Nov 11, 2012 at 1:32am
Topic archived. No new replies allowed.