用VB编写一段代码,将Hello world写入到c:\test.txt文件中,再写另外一段代码,将
1个回答
2013-12-19
展开全部
读文件返回字符串函数
Private Function ReadFile(filePath As String) As String
Dim fileStr As String
Open filePath For Input As #1
Do While Not EOF(1)
Line Input #1, tem
fileStr = fileStr & tem & vbCrLf
Loop
Close #1
ReadFile = fileStr
End Function
'***************************************************************
使用方法:
dim x as string
x=ReadFile("C:\abc.txt")
补充,你把上边的函数代码一起拷进去
Private Function ReadFile(filePath As String) As String
Dim fileStr As String
Open filePath For Input As #1
Do While Not EOF(1)
Line Input #1, tem
fileStr = fileStr & tem & vbCrLf
Loop
Close #1
ReadFile = fileStr
End Function
'***************************************************************
使用方法:
dim x as string
x=ReadFile("C:\abc.txt")
补充,你把上边的函数代码一起拷进去
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询