读指定几行的文本,怎样写?

beyondhell 2006-04-19 09:38:34
1234
12341 12314 123
123123123111111111111111111111111111
111111111111111111111111111111111111
111111111111111111111111111111111111
111111111111111111111111111111111111

1234

类似这样的,只读中间的四行,跳过前两行和第四行后面的

如何写呀?很简单的问题,高手帮忙,谢谢拉!!!
...全文
160 8 打赏 收藏 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
dragonhell 2007-01-08
  • 打赏
  • 举报
回复
SKIPLINE?//
  • 打赏
  • 举报
回复
skipline
beyondhell 2006-04-19
  • 打赏
  • 举报
回复
icrosoft VBScript 编译器错误 (0x800A0414)
调用子程序时不能使用括号
/2.ASP, line 29, column 24
FSOlinedit (fname,"3,4")


晕,实在不会写呀,哪位大哥给写个完整点的。
荣之梦 2006-04-19
  • 打赏
  • 举报
回复
函数可以补全一点。

FSOlinedit(filename,"2-3")
FSOlinedit(filename,"2,5,7")
FSOlinedit(filename,2)
进行判断提取,
sky0120 2006-04-19
  • 打赏
  • 举报
回复
dim filename
filename="1.txt"
response.write FSOlinedit(filename,3)
response.write FSOlinedit(filename,4)

jay_lishijie 2006-04-19
  • 打赏
  • 举报
回复
<%
Set AFileSystemObject = CreateObject("Scripting.FileSystemObject")
Set ATextStream = AFileSystemObject.OpenTextFile("C:\test.txt")
%>
<h3>第一行的内容:</h3>
<% = ATextStream.ReadLine %>
<h3>第二行的内容:</h3>
<% = ATextStream.ReadLine %>
...
---------------------------------------------------------------

<%
Set MyFileObject=Server.CreateObject(“Scripting.FileSystemObject”)
Set MyTextFile=MyFileObject.OpenTextFile(“c:\test.txt”)
While not MyTextFile.AtEndOfStream
Response.Write(MyTextFile.ReadLine)
Wend
MyTextFile.Close
%>
intereye 2006-04-19
  • 打赏
  • 举报
回复
''''''使用FSO读取文件某一行的函数
function FSOlinedit(filename,lineNum)
if linenum < 1 then exit function
dim fso,f,temparray,tempcnt
set fso = server.CreateObject("scripting.filesystemobject")
if not fso.fileExists(server.mappath(filename)) then exit function
set f = fso.opentextfile(server.mappath(filename),1)
if not f.AtEndofStream then
tempcnt = f.readall
f.close
set f = nothing
temparray = split(tempcnt,chr(13)&chr(10))
if lineNum>ubound(temparray)+1 then
exit function
else
FSOlinedit = temparray(lineNum-1)
end if
end if
end function
beyondhell 2006-04-19
  • 打赏
  • 举报
回复
顶下。

28,402

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧