By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,680 Members | 1,710 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,680 IT Pros & Developers. It's quick & easy.

__gc array from string constant?

P: n/a
I'm using a managed C++ class that wants an
unsigned char __gc[] as input. Is there a
way to easily populate that array from a
string constant (or wide string constant, etc.)?

I'd like to do something like:

unsigned char foo __gc[] = "your ad here";

but of course that doesn't work.

Any suggestions welcome.

-- Paul
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Paul Steckler wrote:
I'm using a managed C++ class that wants an
unsigned char __gc[] as input. Is there a
way to easily populate that array from a
string constant (or wide string constant, etc.)?

I'd like to do something like:

unsigned char foo __gc[] = "your ad here";

but of course that doesn't work.

Any suggestions welcome.

-- Paul


Two method, depends on what is the "char" you want. Note, the character
in DotNet is 16 bits.

char str __gc[] = System::Text::Encoding::ASCII->GetBytes(S"Hello
World"); //return 8 bits bytes

unsigned short wstr __gc[] = (S"Hello World")->ToCharArray(); //return
16 bits characters


--
Jacky Kwok
ja***@alumni.cuhk.edu.hk
ja***@compose.com.hk

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.