當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


ASP ReadLine用法及代碼示例

ASP ReadLine方法用於從文本文件讀取一行。它不包括換行符。它是TextStream對象的預定義方法,該方法返回結果字符串。

用法:

TextStreamObject.ReadLine

例:下麵的代碼說明了ASP ReadLine方法。

ASP

<% 
dim fs,f,t,x 
set fs=Server.CreateObject("Scripting.FileSystemObject") 
set f=fs.CreateTextFile("d:\GFG.txt") 
f.writeline("GeeksForGeeks") 
f.writeline("Google Chrome") 
f.writeline("Mozilla Firefox") 
f.close 
  
set t=fs.OpenTextFile("d:\GFG.txt",1,false) 
x=t.ReadLine 
t.close 
Response.Write("The first line in the file " & x) 
%>

輸出:

The first line in the file is GeeksForGeeks

相關用法


注:本文由純淨天空篩選整理自ManasChhabra2大神的英文原創作品 ASP ReadLine Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。