STL String issue while porting code from 32bit to 64bit
807575Jul 8 2010 — edited Jul 20 2010I am trying to compile and run a piece of code on Solar 5.10(sparcv9). This is how the code is
#include <string>
using namespace std;
class samplestring {
public :
int getlength(){
return (header.length());
}
void calculate(){
printf("Header length is %d", getlength());
}
private:
string header;
};
#include <string>
#include <sstream>
#include <iostream>
#include "samplestring.hpp"
using namespace std;
int main()
{
samplestring sample;
sample.calculate();
return(0);
}
The above sample code works fine. But the real code in my application when trying to check the length of the string, it is returning a garbage value in 64bit where as the same code in 32bit gives me the correct value.
Can anyone help me on this.