On 07/04/2017 04:47 PM, Dexter wrote:
Hi everyone!

Could you tell me please, how I can clearly convert char (&name)[N] to 
nsACString?

I tried this:

char* cname = new char[N];
memcpy(cname, &name, N);
nsAutoString strName;
strName.AssignWithConversion(cname, N);

I can't find out how to get nsACString. I could use nsACString instead of 
nsAutoString, but nsACString hasn't AssignWithConversion(), as I know.


nsAutoString isn't nsACString. Note the 'C' in the name.

But you can do for example
nsAutoCString foo;
foo.AppendASCII(cname);
or
foo.AppendLiteral(some_literal)
or maybe you want to use nsDependentCString?
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to