描述
读取一整行(最多,但不包括换行符)从TextStream文件并返回结果字符串.
FreeBASIC 语法
FUNCTION ReadLine () AS CWSTR |
引用文件
CTextStream.inc
示例
#include "windows.bi"
#include "Afx/AfxScrRun.bi"
#include "Afx/CTextStream.inc"
using Afx
' // Create an instance of the CTextStream class
DIM pTxtStm AS CTextStream
' // Open file as a text stream
DIM cwsFile AS CWSTR = ExePath & "\Test.txt"
pTxtStm.Open(cwsFile, IOMode_ForReading)
' // Read the file sequentially
DO
IF pTxtStm.EOS THEN EXIT DO
DIM curLine AS LONG = pTxtStm.Line
DIM cwsText AS CWSTR = pTxtStm.ReadLine
PRINT "Line " & STR(curLine) & ": " & cwsText
LOOP
PRINT "Press any key..."
SLEEP