导航:  CTextStream Class >

WriteLine

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

描述

 

将指定的字符串和一个TextStream文件换行符.

 

FreeBASIC 语法

 

FUNCTION WriteLine (BYREF cwsText AS CWSTR) AS HRESULT

 

参数

 

cwsText

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

 

' // Create a text stream

DIM cwsFile AS CWSTR = ExePath & "\Test.txt"

pTxtStm.Create(cwsFile, TRUE)

 

' // Write a string and an end of line to the stream

pTxtStm.WriteLine "This is a test."

 

' // Write more strings

pTxtStm.Write "This is a string."

pTxtStm.Write "This is a second string."

 

' // Write two blank lines (the first will serve as an end of line for the previous write instructions)

pTxtStm.WriteBlankLines 2

pTxtStm.WriteLine "This is the end line."

 

PRINT

PRINT "Press any key..."

SLEEP