K
klaus hoffmann
In the following program I would expect r to be a zero terminated string of
length 1. Am I wrong? The STL I'm using omit the zeroterm in this situation.
Klaus
#include <iostream>
using namespace std; //introduces namespace std
int main(){
string x("12");
string::iterator p(x.begin()),q(x.begin()+1);
string y(p,q);
const char *r=y.c_str();
cout <<r << " "<< int(r[0])<< " "<< int(r[1]);
return 0;
end;
length 1. Am I wrong? The STL I'm using omit the zeroterm in this situation.
Klaus
#include <iostream>
using namespace std; //introduces namespace std
int main(){
string x("12");
string::iterator p(x.begin()),q(x.begin()+1);
string y(p,q);
const char *r=y.c_str();
cout <<r << " "<< int(r[0])<< " "<< int(r[1]);
return 0;
end;