导航:  CTextStream Class >

ReadAll

上一页返回章节概述下一页

描述

 

TextStream读取整个文件并返回结果字符串.

 

FreeBASIC 语法

 

FUNCTION ReadAll () 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 all the contents of the file

DIM cwsText AS CWSTR = pTxtStm.ReadAll

PRINT cwsText

 

PRINT

PRINT "Press any key..."

SLEEP