[問題] CLR~~systnm::String^轉char[]

看板C_and_CPP (C/C++)作者 (pineapple)時間15年前 (2011/05/13 09:11), 編輯推噓1(102)
留言3則, 2人參與, 最新討論串1/2 (看更多)
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) vc++2008~~windows form 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) CLR類別庫 問題(Question): 想請問一下,我想將textbox中輸入的值取出,丟給dll的函式用, 但是出現運算子轉換錯誤,麻煩各位教導我該怎麼處理 錯誤結果(Wrong Output): 無法將參數 1 從 'System::String ^' 轉換成 'char *const ' 程式碼(Code):(請善用置底文網頁, 記得排版) static void table(char str0[],char str1[]); -DLL檔 ------------------------------------------------------ Checkdll::MyCheckdll::table(textBox2->Text,"test"); -clr主程式 補充說明(Supplement): 我找了很多資料,卻一直無法把string^轉成char[],只好麻煩各位教我,謝謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 210.242.65.228

05/13 10:05, , 1F
System::Runtime::InteropServices::Marshal::StringTo..
05/13 10:05, 1F

05/13 11:16, , 2F
E大,請問這個方法要先宣告哪些變數嗎?? 抱歉..有點不太懂
05/13 11:16, 2F

05/13 11:28, , 3F
我找到方法了,謝謝e大教導...感謝^^
05/13 11:28, 3F
文章代碼(AID): #1Dp8K_Hb (C_and_CPP)
文章代碼(AID): #1Dp8K_Hb (C_and_CPP)