cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
string printing issues
string printing issues
Nov 11, 2012 at 12:58am UTC
schwick
(6)
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 UTC
Nov 11, 2012 at 1:32am UTC
Darkmaster
(564)
http://www.cplusplus.com/reference/string/string/end/
http://www.cplusplus.com/reference/string/string/size/
Topic archived. No new replies allowed.