编写一个程序,统计data.txt文件的行数,并将所有行前加上行号后写到data1.txt文件中。
1个回答
展开全部
<html>
<丛歼body>
<%
dim allline,path
allline=0
path="data.txt"
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(Server.MapPath(path), 1)
Set MyFile = fs.CreateTextFile(server.MapPath(path&"tp"戚信), True)
do while f.AtEndOfStream = false
MyFile.WriteLine(f.Line & "高郑轮 " & f.ReadLine)
allline=f.Line
loop
f.Close
MyFile.Close
fs.deleteFile server.MapPath(path)
fs.moveFile server.MapPath(path&"tp"),Server.MapPath(path)
Set f=Nothing
Set fs=Nothing
%>
共有<%=allline%>行
</body>
</html>
<丛歼body>
<%
dim allline,path
allline=0
path="data.txt"
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(Server.MapPath(path), 1)
Set MyFile = fs.CreateTextFile(server.MapPath(path&"tp"戚信), True)
do while f.AtEndOfStream = false
MyFile.WriteLine(f.Line & "高郑轮 " & f.ReadLine)
allline=f.Line
loop
f.Close
MyFile.Close
fs.deleteFile server.MapPath(path)
fs.moveFile server.MapPath(path&"tp"),Server.MapPath(path)
Set f=Nothing
Set fs=Nothing
%>
共有<%=allline%>行
</body>
</html>
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询