將StringGrid裡的資料存成txt檔 |
尚未結案
|
superyoung
一般會員 發表:14 回覆:24 積分:7 註冊:2004-07-02 發送簡訊給我 |
|
nlj859
資深會員 發表:139 回覆:375 積分:322 註冊:2004-03-20 發送簡訊給我 |
Hello superyoung, 請參考底下程式碼:
#include發表人 - nlj859 於 2004/08/03 01:28:48 發表人 - nlj859 於 2004/08/03 15:25:47 |
superyoung
一般會員 發表:14 回覆:24 積分:7 註冊:2004-07-02 發送簡訊給我 |
|
nlj859
資深會員 發表:139 回覆:375 積分:322 註冊:2004-03-20 發送簡訊給我 |
|
superyoung
一般會員 發表:14 回覆:24 積分:7 註冊:2004-07-02 發送簡訊給我 |
|
nlj859
資深會員 發表:139 回覆:375 積分:322 註冊:2004-03-20 發送簡訊給我 |
Hello superyoung, 不曉得你有沒有看存在c:\rowcol.txt那個文字檔?
程式真的照你的意思一樣,StringGrid和.txt的內容都一樣.
#include發表人 - nlj859 於 2004/08/03 15:25:13 |
superyoung
一般會員 發表:14 回覆:24 積分:7 註冊:2004-07-02 發送簡訊給我 |
|
nlj859
資深會員 發表:139 回覆:375 積分:322 註冊:2004-03-20 發送簡訊給我 |
Hello superyoung, 假設你每個cell裡面的字最多10個,那麼程式更改如下:
for (int col=1;col<=StringGrid1->ColCount-1;col ) { str=""; for (int row=1;row<=StringGrid1->RowCount-1;row ) { int CellsLength=StringGrid1->Cells[row][col].Length(); if (StringGrid1->Cells[row][col]!="") str=str StringGrid1->Cells[row][col] AnsiString::StringOfChar(' ',10-CellsLength) " "; else str=str AnsiString::StringOfChar(' ',10) " "; } outfile << str.c_str() << endl; }發表人 - nlj859 於 2004/08/03 15:17:58 發表人 - nlj859 於 2004/08/03 15:24:19 |
superyoung
一般會員 發表:14 回覆:24 積分:7 註冊:2004-07-02 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |