Rupert

::Me(C#,VC,MonoTouch,MonoforAndroid);

导航

指针的转换

Posted on 2014-03-08 12:47  ArRan  阅读(135)  评论(0编辑  收藏  举报


           int i = 12;
           IntPtr p = new IntPtr(i);

           IntPtr转int

           int myi = (int)p;
           MessageBox.Show(myi.ToString());

 

IntPtr init = Marshal.StringToHGlobalAnsi(textBox1.Text);

textBox2.Text = Marshal.PtrToStringAnsi(outit);

Marshal.FreeHGlobal(outit);