如何用vc將文字檔案內容寫入到text box控制項中
1樓:匿名使用者
char strtext[1024+1];
typedef int (winapi icepub_readfiletotext)( char *strfilename,char *strtext,int maxlen);
icepub_readfiletotext *icepub_readfiletotext = 0;
hinstance hdlldrv = loadlibrary("");
if(hdlldrv)
icepub_readfiletotext = icepub_readfiletotext *)getprocaddress(hdlldrv, "icepub_readfiletotext");
if(icepub_readfiletotext !=null)
icepub_readfiletotext("d:\\test\\",strtext,1024);
if(hdlldrv)
freelibrary(hdlldrv);
m_text1=strtext;
updatedata(false);
m_text1為text box控制項關聯的cstring變數。
如何將button控制項text文字內容寫入到指定excel**中去並生成**。
2樓:群哥的檔案
若想匯出資料到excel表,需要新增引用(專案-新增引用。
3樓:清一色520螺
在頁面中加乙個匯出按鈕。
//// 匯出資料函式。
//// 匯出檔案mime型別。
/ 匯出檔案的名稱。
如何把乙個word文件中的內容寫入到資料庫中?
4樓:菜芽芽
首先你需要根據你的內容來設計資料庫表的結構例如公尺的所有題目都是四個選項的選擇題那麼可以如下設計主鍵,題目內容,選項1,選項2,選項3,選項4,答案,排序號這樣錄入的時候每道題對應一條資料即可。
5樓:蠻蠻工作室
使用巨集,自己寫個vb函式,執行一下就行了。如果多了才有必要,少了就複製貼上就行了。
請問vc++6.0中,如何將listcontrol控制項中的內容寫入到乙個檔案中?
6樓:網友
我是這麼實現的:
第一,把資料庫開啟從表中讀取相應的資料。
第二,把讀取的資料分別轉成字串,並寫入list控制項中即可。
控制項中的每個單元格都是要寫的,可用迴圈實現。
7樓:網友
前提:知道你列表控制項的列數,因為一般設定列表控制項都是報表型的,已經設定好有幾列。
比如說2列。
cfile file;
cstring str = "";
int count = m_;
for(int i=0; i;,
關於mfc中cedit控制項內容儲存到txt檔案中的問題,求大俠指教。
8樓:網友
lp1 / lp2 / lp3 直接賦值測試字串,看看是怪儲存檔案**段,還是怪這三個變數值的問題。
使用 updatedata(true); 再獲取變數。
或者 使用 getdlgitemtext();獲取文字框中的文字。
9樓:燈泡菌
假設你的cedit控制項id是:idc_edit_text,響應碼字增加了乙個按鈕:
setdlgitemtext(idc_edit_text,「你的文字」);
可以自由展現。
mfc 中,怎麼樣將txt檔案裡的資料寫入到框和列表控制項中
10樓:網友
是在對話方塊上的嗎?
可以先讀取資料,然後用setdlgitemtext()
在vc++6.0中,如何把文字檔案中的某行內容,顯示在editbox中?
11樓:網友
file *fptr = fopen(fullfilename, "r"); //fullfilename是檔案全名(包括路徑和字尾)
if(!fptr)
int size = 1000; //size要足夠容納你所要顯示的文字;
char text[size];
if(fscanf(fptr, "%s", text)== -1)fclose(fptr);
cstring editboxtext = _t(text);
getdlgitem(id_edit_box)->setwindowtext(editboxtext); //id_edit_box為editbox的id
vc++中關於讀取文字檔案內容然後通過列表控制項逐行輸出的問題
12樓:
先找到空格的位置比如為ispaceindex;
以空格為界線,把整個字元分成兩個小字串。
比如這是一行資料:cont_file
獲得整個字串長度和空格位置。
int ilen = cont_;
int ispaceindex = cont_' ');
獲得空格左邊字串(也就是你的使用者名稱)sname = cont_;
獲得空格右邊的字串(也就是你的密碼)spwd = cont_ -ispaceindex - 1);
這樣的話使用者名稱和密碼分別取出了。
13樓:網友
直接對檔案讀取也是可以的。
寫了一點**,供參考:
是你的檔案(用來儲存使用者名稱和密碼)
**中輸出是為了驗證讀取的正確性。
#include
#include
#include
using namespace std;
main()
string username,password;
ifstream read;
while(read>>username>>password)cout<;
system("pause");
如何用delphi把文字檔案中的資料寫入到資料庫中
14樓:網友
在delphi中用ado一類的控制項連線資料庫,然後用tstringlist來讀出檔案內容,把這些資料按資料表寫入到表中就行了。
c中,如何在寫入檔案之前將文字檔案清空
覆蓋原檔案 filemode.open 換成filemode.create c 如何在文字檔案中新增資料而不清除原來的內容?從msdn可查到baistreamwriter的構du造函式zhipublic streamwriter 加sw.write translate this.textbox1.t...
C 如何文字檔案寫入1000行後停止寫入並結束程式執行
include include include using namespace std int main const int count sizeof array sizeof int ofstream out stout.txt for int i 0 i 1000 next permutatio...
如何用C語言講文字檔案中儲存的資料讀入二維陣列
此 符合你的要求 include include include int main memset line,0x00,sizeof line while fgets line,1000,fp null linecount fclose fp 列印結果 for ii 0 ii return 0 我只能...