[問題] 檔案內的字串拆解問題!?

看板C_and_CPP作者 (楓仔....)時間13年前 (2011/03/18 12:26), 編輯推噓1(102)
留言3則, 3人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) VC++2010 餵入的資料(Input): 從讀檔,將檔案輸入進去 預期的正確結果(Expected Output): 應該是要可以將檔案裡的資料,先做多行拆解成一行行存到陣列裡 再將每行陣列的資料拆解存到另外的陣列裡 錯誤結果(Wrong Output): > error C2440: '正在初始化' : 無法由'int' 轉換為 'cli::array<Type> ^' 1> with 1> [ 1> Type=System::String ^ 1> ] error C2143: 語法錯誤 : 遺漏 ';' (在 '=' 之前) error C2143: 語法錯誤 : 遺漏 ';' (在 '=' 之前) 程式碼(Code):(請善用置底文網頁, 記得排版) ublic: array<String^>^ AAA; private: System::Void openFileDialog1_FileOk(System::Object^ sender, System::ComponentModel::CancelEventArgs^ e) { textBox1->Text = openFileDialog1->FileName; //將路徑顯示於TextBox1 System::IO::FileStream ^ fs = gcnew FileStream(textBox1->Text, FileMode::Open,FileAccess::Read); System::IO::StreamReader ^ sr = gcnew StreamReader(fs); String^ Str; Str=sr->ReadToEnd(); sr->Close(); fs->Close(); AAA = Str->Split('\n'); } private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) { textBox3->Text = textBox38->Text; textBox4->Text = textBox39->Text; int x =System::Convert::ToInt32(textBox38->Text); int y =System::Convert::ToInt32(textBox39->Text); for(int i=0;i < AAA->Length ;i++) { array<String^>^BB(i) = AAA(i)->split("//"); } } }; 補充說明(Supplement): -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.223.227.100

03/18 12:41, , 1F
請用置底文的網址貼程式碼
03/18 12:41, 1F

03/18 13:22, , 2F
Managed C++ ?
03/18 13:22, 2F

03/18 13:26, , 3F
陣列有 () 運算子?
03/18 13:26, 3F
文章代碼(AID): #1DWjxaMv (C_and_CPP)