[問題] BCB StringGrid讀取txt問題

作者: archer123 (自由)   2014-07-01 14:33:48
我有寫好存檔的部分下面是程式碼
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(SaveDialog1->Execute())
{
TStringList *sl=new TStringList;
String s = " x y 種類";
sl->Add(s);
for(int j=1;j<StringGrid1->RowCount;j++)
{
for(int i=1;i<StringGrid1->ColCount;i++)
{
if (StringGrid1->Cells[i][j]!="")
{
String s=StringGrid1->Cells[i][j];
String w=i;
String e=j;
sl->Add(" "+w+"\t"+e+"\t"+s);
}
}
}
sl->SaveToFile(SaveDialog1->FileName);
}
}
下面是存完後開啟txt檔後顯示的結果
x y 種類
16 2 A
17 2 b
18 2 D
19 2 D
20 2 D
14 3 其它
15 3 D
16 3 D
17 3 D
18 3 D
19 3 D
20 3 D
21 3 D
22 3 D
13 4 D
14 4 D
15 4 D
16 4 D
請問要如何把我存好的這些檔案在讀取回去到StringGrid裡?
x.y分別是行列的位置不需要寫入 只要寫入A.b.其它到cell裡面就好
上網爬了很多文,但還是找不到,小弟不才,可以給小第一點提示嗎?
麻煩各位了
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
補充說明(Supplement):
作者: archer123 (自由)   2014-07-01 15:33:00
不好意思小弟已經解決

Links booklink

Contact Us: admin [ a t ] ucptt.com