如何读取TXT里面的代码:
如何读取TXT里面的代码:
比如同目录下1.TXT内容的第一行是一个歌曲地址http://res.5k3g.com/up/tring/files/11110.wma
而我想直接读取1.TXT里面的歌曲内容直接播放它 WindowsMediaPlayer1.URL = app.Path & 1.txt里面的歌曲内容!请问该怎么写!
[解决办法]
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.OpenTextFile(app.Path & "1.txt", ForReading)
ReadLineTextFile = MyFile.ReadLine
[解决办法]
open "d:\1.txt" for input as #1
line input #1,s
close #1
WindowsMediaPlayer1.URL = s
[解决办法]
如何读/写 Binary File
'以下是读取Binary file的程式
Dim Buff() as Byte
Open "d:\csys\8504\ctc" For Binary Access Read As #1
ReDim Buff(267)
Do While Not EOF(1)
Get #1, , Buff '每次读268个byte进来
'Call 处理Buff 的Routine
Loop
Close #1
'以下是写入Binary file的程式
Dim Buff() As Byte
Open "c:\tc" For Binary Access Write As #1
ReDim Buff(10)
Buff = StrConv("这是一个11", vbFromUnicode)
Put #1, , Buff
ReDim Buff(1)
Buff(0) = 210
Buff(1) = 70
Put #1, , Buff
Close #1
End Sub