怎么读取文本文件?急急急
怎么从c:\123.txt读取一行数据,每个数据之间用 “,“隔开 ,读取后第一行数据为阿a(0,0),a(0,1)......第二行为a(1,0),a(1,1)....
一下代码可以读出 这个文本文档有多行,每行多少列!和内容,要把内容放数组,只要再做循环就可以了! Dim i%, k As Integer, t(), a() Private Sub Command1_Click() Text1。Text = "" Dim inputdata Open "c:3。
txt" For Input As #1 Do While Not EOF(1) Line Input #1, inputdata i = i + 1 ReDim t(i) t(i) = Len(inputdata) '算出每行多少字符,就是多少列 ReDim a(i, t(i)) a(i, t(i)) = inputdata '为了能把每个对应这里把每行的数据记录 Picture1。
Print i; t(i); "("; a(i, t(i)); ")" Text1。Text = Text1。Text + inputdata + vbCrLf Loop Close #1 End Sub 。
因为不知道 123。txt 的内容, 也就不知道你的对不对? 请把123。txt和程序告诉我。这个问题不难解决。 程序for string data: Please tell me is this right for you。 假设 123。
txt是这样: asdf,erty,wefv,tgbhh,。。。h deep,cat,red,。。。yellow 。。。。。 。。。。。 Please let me know, what do you think about your program。
Thhis program can read any line and one line have any number of data。 Now you have two programs。 One is for string and attachment for interger。
Private Sub Command1_Click() Dim i, j, p, pf As Integer Dim str As String Dim cell(0 To 80, 0 To 80) As String p = 1 i = 0 j = 0 Open "c:\123。
txt" For Input As #1 Do Until EOF(1) = True Line Input #1, str pf = InStr(p, str, ",") Do While (pf <> 0) cell(i, j) = Mid(str, p, pf - p) p = pf + 1 j = j + 1 pf = InStr(p, str, ",") If pf = 0 Then cell(i, j) = Mid(str, p, Len(str)) End If Loop i = i + 1 j = 0 p = 1 Loop Close #1 For i = 0 To 2 For j = 0 To 9 Text2 = Text2 & cell(i, j) & " " Next Next End Sub attachment for interger data。
int i,j; ifstream input_file; ofstream output_file; fstream io_file; input_file.open("c:\123.txt"); for(j=0;j>a(i,j);}
答:简单的说文本文件是指以ASCII码方式存储的文件,具体的说,英文、数字等字符存储的是ASCII码,而汉字存储的是机内码。文本文件中除了存储文件有效字符信息(包括...详情>>
问:VB与Matlab混合编程时,如何让matlab界面隐藏
答:在Api浏览器中找findwindow()函数和showwindow()函数,然后用 dim a as long a= Findwindow(vbnullstr...详情>>
答:平板和电脑一般不是一个系统,所以需要在平板商城自行下载(记得给好评哦,亲)详情>>