Hello,
another question: how can I get global string variable for a process then save it? I want to put the LISP global string variable *CI_Ido* into str string variable using the getsym function. I have an rstring, and I want to convert to a string:
int rc;
struct resbuf *rb;
string longT,
str;
rc = ads_getsym(_T("*CI_Ido*"), &rb); if (rc == RTNORM && rb->restype == RTSTR) { str = rb->resval.rstring; /* this my question */ if (str.length()==17) { longT = str.substr(14,4) + "." + str.substr(1,4); rb = ads_buildlist(RTSTR, longT, 0); rc = ads_putsym(_T("*CI_Valt*"), rb); ads_rett(); } else { ads_retnil(); } } else { ads_retnil(); } ads_relrb(rb);
many thanks,
Csaba
Solved! Go to Solution.
Solved by diagodose2009. Go to Solution.
Solved by Alexander.Rivilis. Go to Solution.
What exactly is the problem? Build error? Runtime error? Crash?
Not string but wstring
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
TRY MY SOLUTION
[code]
ACHAR *
/*FCN*/lspfn_setq(ACHAR *variabile,const ACHAR *value)
{ int rc;
if (variabile==NULL)
{
ads_retnil();
return(variabile);
};
struct resbuf *rb;
rb = ads_buildlist(RTSTR, value, NULL);
rb.rbnext=nil;
rc = ads_putsym(variabile, rb);
if (RTNORM==ads_retstr(rb->resval.rstring))
{ ads_relrb(rb);
ads_retstr(value);
return(value);
};
ads_relrb(rb);
ads_retnil();
return(NULL);
};
int
/*FCN*/test()
{ int rc;
struct resbuf *rb;
ACHAR str2[12];
rc = ads_getsym(_T("*CI_Ido*"), &rb);
if (rc!=RTNORM)
{ ads_retnil(); return(rc);};
iF (rb==NULL)
{ ads_retnil();
return(RTERROR);
};
if (rb->restype != RTSTR)
{ ads_retnil();
return(RTCAN);
};
if (rb->resval.rstring==NULL)
{ ads_retnil();
return(RTREJ);
};
rc=_tcslen(rb->resval.rstring);
if (rc!=17)
{ ads_retnil();
return(RTFAIL);
};
// here maximum speed and codesize it si little
str2[0]=rb->resval.rstring[14];
str2[1]=rb->resval.rstring[15];
str2[2]=rb->resval.rstring[16];
str2[3]=rb->resval.rstring[17];
str2[4]=_T('.'); // here maximum speed and codesize it si little
str2[5]=rb->resval.rstring[01];
str2[6]=rb->resval.rstring[02];
str2[7]=rb->resval.rstring[03];
str2[8]=rb->resval.rstring[05];
str2[9]=_T('\0');
str2[10]=_T('\0');
str2[11]=_T('\0');
lspfn_setq(_T("*CI_Valt*"), str2);
ads_rett();
ads_relrb(rb);
return(RTNORM);
}
[/code]
The error was: no operator "=" matches this operand.
The wstring type has resolved it, and this one is the easyest way for me, but I will test the 2nd solution and build in.
Maybe you ask why I need ObjectARX for this process, why not enough LISP, because it's a test and I need to compare the results of LISP and ObjectARX.
Thanks for everyone the answer!
Can't find what you're looking for? Ask the community or share your knowledge.