3 Replies - 6430 Views - Last Post: 06 June 2012 - 02:23 AM

#1 JohnBoyMan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 24-February 12

c char to cli char

Posted 01 March 2012 - 12:42 AM

Hello all, I am trying to convert a c char to cli char. I have looked everywhere but only came up with one thing and that is that System::Char from cli is not the same as char from c. I am converting a very large project form c to cli, so i cant make any mistakes. This is what my c char looks like.


i wana conver this to a cli char

static char[] BlankChars = { ' ' };  




normall i would do this.


    array<System::Char^>^ BlankChars;       
    BlankChars = gcnew array<System::Char^>(10);     
    BlankChars = { ' ' };  





One problem i have with this way, is that i have to give that array a size, and i really dont want to , because i dont want a bunch of extra space in every array. Is there a cli array that does not require a size. Or is there a piece of code in cli that is known as undefined.

Thanks, i would normall just wing this, but my project is so big i can't be wrong, thanks all eyes and minds. good'aye!!

Is This A Good Question/Topic? 0
  • +

Replies To: c char to cli char

#2 sarmanu  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 966
  • View blog
  • Posts: 2,362
  • Joined: 04-December 09

Re: c char to cli char

Posted 01 March 2012 - 01:15 AM

array<System::Char>^ BlankChars = { ' ' }; ?
Was This Post Helpful? 0
  • +
  • -

#3 JohnBoyMan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 24-February 12

Re: c char to cli char

Posted 01 March 2012 - 01:45 AM

Would i have to initialize that?

I tryed using just char in cli, and it worked ,like this.


 public: char a;

 // this to initialize it 

  char a = ' ';


I find it very odd that it works, because its not using ^ like the rest of the managed c++ that im using.
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3449
  • View blog
  • Posts: 10,643
  • Joined: 05-May 12

Re: c char to cli char

Posted 06 June 2012 - 02:23 AM

Nevermind...

This post has been edited by Skydiver: 06 June 2012 - 02:26 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1