dim FileNum as long dim tmpa="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 filenumb="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
dim a() as byteredim a(filelen("a.txt")-1)dim b() as byteredim b(filelen("b.txt")-1)open "a.txt" for binary as #11open "b.txt" for binary as #22open "c.txt" for binary as #33get #11,aput #33,aget #22,bput #33,bclose(11)close(22)close(33)
dim a() as byteredim a(filelen("a.txt")-1)dim b() as byteredim b(filelen("b.txt")-1)open "a.txt" for binary as #11open "b.txt" for binary as #22open "c.txt" for binary as #33get #11,,aput #33,,aget #22,,bput #33,,bclose(11)close(22)close(33)
FSO方法。 先读取A.txt文件内容。在写到B.txt文件,再创建新文件C.txt文件。 读取文件: dim fso as new filesystemobject ,fil1 as file,ts as textstreamset 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("要复制的文件目录")
Shell "cmd /c copy c:\a.txt+c:\b.txt c:\c.txt"
End Sub
dim tmpa="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 filenumb="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
只能在windows上用
我的意思是说,如果在98下,应该:
Shell "Command.com /c copy d:\a.txt+d:\b.txt d:\c.txt"
原来你是指不同的Windows系统啊,误会了.回楼上的金兵甲:
WinCE也算是Windows吧,再说我问的是VB不是EVB回楼上的金兵乙:
我问的是VB不是VBS
先读取A.txt文件内容。在写到B.txt文件,再创建新文件C.txt文件。
读取文件:
dim fso as new filesystemobject ,fil1 as file,ts as textstreamset 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("要复制的文件目录")