Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:如何读取TXT文件内容?

1楼
deni977 发表于:2014/1/17 22:45:14
我们知道,在后台,可以用debugfile将变量输出到文件,反过来,要将TXT文件中的一个数值,如何读取到金字塔后台的变量中?深度请教!
2楼
王锋 发表于:2014/1/18 14:10:38

3.1版已经增加了INI文本文件的读写函数,你可以直接使用这个来操作了

 

参考

http://www.weistock.com/bbs/dispbbs.asp?boardid=2&Id=59406

[此贴子已经被作者于2014/1/18 14:10:47编辑过]
3楼
pel46585 发表于:2014/1/24 13:16:14
Sub WriteTxt()
Set WSHShell = CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop")
xFile = DesktopPath & "\config.txt"
MyTxt = Application.AppPath & " 文件创建时间 " & Now()
Set fso = CreateObject("scripting.FileSystemObject")    '绑定fso对象
Set MyFile = fso.CreateTextFile(xFile, True)
MyFile.WriteLine (MyTxt)
MyFile.Close
Set MyFile = Nothing
Set fso = Nothing
End Sub
Sub ReadTxt()
Set WSHShell = CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop")
xFile = DesktopPath & "\config.txt"
Set fso = CreateObject("scripting.FileSystemObject")    '绑定fso对象
Set MyFile = fso.openTextFile(xFile, 1, True)       '用.open方法打开文件
Do Until MyFile.AtEndOfStream
    strLine = MyFile.ReadLine
    application.MsgOut strLine
Loop
MyFile.Close
Set MyFile = Nothing
Set fso = Nothing
End Sub
4楼
deni977 发表于:2014/1/25 12:12:57
请问楼上这个是在自定义函数里面实现吗?
共4 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.03223 s, 2 queries.