• Advertisement
Sign in to follow this  

problem with wcslen String ^ to char *

This topic is 2893 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all , I have some peice of code which is working fine and an analogous code in the same fine returning errors.. working code : pin_ptr<const wchar_t> file_x= PtrToStringChars(path); char * file = new char(wcslen(file_x)+1); int t= 0 ; while(file_x[t]!= '\0') { file[t] = (char)file_x[t]; ++t; } failing code : String^ valuefromc_seed ; valuefromc_seed = gcnew String(Y); (y is defined in a dll using c file) pin_ptr<const wchar_t> seed_x= PtrToStringChars(valuefromc_seed); char * seed = new char(wcslen(seed_x)); int u= 0 ; while(seed_x[u]!= 'm') { seed[u] = (char)seed_x[u]; ++u; } Its precisely failing at char * seed = new char(wcslen(seed_x)); .. it says head corruption... anyone has any input on this ? I need to use wcslen cos , i am using express edition 2008 ...with no marhsalling package.. thanks

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement