scanf("%s",this->txt_cfile_par->Text);String^ temp = this->txt_cfile_par->Text;void MarshalString ( String ^ s, string& os ){using namespace Runtime::InteropServices;const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(s)).ToPointer();os = chars;Marshal::FreeHGlobal(IntPtr((void*)chars));}strncpy(cfile_par,temp.c_str(),c_str.length());System::Windows::Forms::MessageBox::Show(temp);error C2601: “MarshalString”: 本地函數定義是非法的error C2228: “.c_str”的左邊必須有類/結構/聯合error C2228: “.length”的左邊必須有類/結構/聯合error C2679: 二進制“+”: 沒有找到接受“char *”類型的右操作數的運算符(或沒有可接受的轉換)
1 回答

冉冉說
TA貢獻1877條經驗 獲得超1個贊
我怎么覺得你連最基本的編程概念都沒入門呢.......
你這好像是C#的代碼
函數是不能嵌套的吧,C#應該也是不能在一個函數內部定義一個函數(雖然我C#沒那么熟)
strncpy(cfile_par,temp.c_str(),c_str.length());
改成
strncpy(cfile_par,temp.c_str(), temp.c_str.length());
- 1 回答
- 0 關注
- 80 瀏覽
添加回答
舉報
0/150
提交
取消