janarbek
2007-10-09 15:28:31 UTC
Hi all,
Sorry for sending basic questions,..may be u guys see I am doing progress in CORBA with c++. Ok my question is,...
I want to change lenght of CORB::String_var data variable in a loop and set new const string to my data variable.
What I did was in the below.
My IDL
interface stringTestServer {
void setSize(inout short size);
string returnType();
};
Server code:
data = ( char*) "A";
void stringTestServer_i::setSize(CORBA::Short& size)
{
const char *str ="";
std::string s ="";
for(int i=0;i<size;i++)
{
s+="a";
}
str = s.c_str();
cout<<"Str="<<str<<endl; str varaible changes as loop
data = CORBA::string_dup(str); --> Here is the problem data always prints A
cout<<"Data="<<*data<<endl;
}
char* stringTestServer_i::returnType()
{
return CORBA::string_dup(data);
}
I hope I made myself understand, basically I want to change lenght of data and set new string each time.
==================================================================================================================================================================
Janarbek, Researcher.
Software Robot Research Team, ETRI(Electronics and Telecommunications Research Institute)
161 Kajong-Dong, Yusong-Gu, TAEJON, 305-350, KOREA
Email : ***@etri.re.kr
Phone : 82-42-860-1838
Fax : 82-42-860-6790
Cell Phone: 82-10-8692-8103
===================================================================================================================================================================
---------------------------------
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20071009/e9eec34e/attachment.htm
Sorry for sending basic questions,..may be u guys see I am doing progress in CORBA with c++. Ok my question is,...
I want to change lenght of CORB::String_var data variable in a loop and set new const string to my data variable.
What I did was in the below.
My IDL
interface stringTestServer {
void setSize(inout short size);
string returnType();
};
Server code:
data = ( char*) "A";
void stringTestServer_i::setSize(CORBA::Short& size)
{
const char *str ="";
std::string s ="";
for(int i=0;i<size;i++)
{
s+="a";
}
str = s.c_str();
cout<<"Str="<<str<<endl; str varaible changes as loop
data = CORBA::string_dup(str); --> Here is the problem data always prints A
cout<<"Data="<<*data<<endl;
}
char* stringTestServer_i::returnType()
{
return CORBA::string_dup(data);
}
I hope I made myself understand, basically I want to change lenght of data and set new string each time.
==================================================================================================================================================================
Janarbek, Researcher.
Software Robot Research Team, ETRI(Electronics and Telecommunications Research Institute)
161 Kajong-Dong, Yusong-Gu, TAEJON, 305-350, KOREA
Email : ***@etri.re.kr
Phone : 82-42-860-1838
Fax : 82-42-860-6790
Cell Phone: 82-10-8692-8103
===================================================================================================================================================================
---------------------------------
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20071009/e9eec34e/attachment.htm