[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EL-MFC Programming Quest...



PureBytes Links

Trading Reference Links

I'm having a problem that maybe someone can help with.  I am trying to send
back an MFC CString back to EL converted to a C string with a
(LPSTR)(LPCTSTR) cast.

CString csStr;
csStr = "test"
return (LPSTR)(LPCTSTR)csStr;

I get back garbage in Easy Lang (EL) with this code.  I know EL is sending
me good strings because I can see them.  I also get back garbage when I
return a char variable such as like what you guys have done in your MFC
example.  I use (assume 'begin' is a defined counter)

		char newstr[250];

		newstr[begin] = 'a';
		begin++;
		newstr[begin] = 'b';
		begin++;
		newstr[begin] = 'c';
		begin++;
		newstr[4] = '\0';

		return newstr;

And I get back garbage in EL.  However when I simply pass back the string
that EL has sent me like you guys do in the sample, I get back the correct
string.  This leads me to believe that there is a difference in the
characters being sent from tradestation, perhaps with teh high bit set >7F
or something that would make characters generated with my compiler (VC 6.0)
unrecognizable to EL.

This has got to be a farily common problem and be an easy solution for it.

Thanks,
Brian