FSO方法。
先读取A.txt文件内容。在写到B.txt文件,再创建新文件C.txt文件。
读取文件:
dim fso as new filesystemobject ,fil1 as file,ts as textstream
set ts=fil1.openastextstream(forreading)
s=ts.readline
msgbox s
ts.close
写入文件:
dim fso,txtfile
set fso=createobject("scripting.filesystemobject")
set txtfile=fso.createtextfile("c:\testfile.txt",true)
txtfile.write("文字")
txfile.close
复制文件:
dim fso as new filesystemobject,txtfile,fil1,fil2
set txtfile=fso.createtextfile("c:\tetfile.txt",true)
开始复制fil1.copy("要复制的文件目录")
a="a.txt"
filenum=freefile()
open a For Binary As FileNum
tmp=input( filelen(a),filenum)
close filenum
filenum=freefile()
c="c.txt"
open C For Binary As filenum
write filenum , tmp
close filenum
b="b.txt"
filenum=freefile()
open a For Binary As FileNum
tmp=input( filelen(a),filenum)
close filenum
filenum=freefile()
c="c.txt"
open C For Binary As filenum
write filenum , tmp
close filenum