描述
将指定字符串到TextStream文件.
FreeBASIC 语法
FUNCTION Write (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 "Press any key..."
SLEEP