編集

次の方法で共有


OutStream.WriteText([Text] [, Integer]) Method

Version: Available or changed with runtime version 1.0.

Writes text to an OutStream object.

Syntax

[Written := ]  OutStream.WriteText([Text: Text] [, Length: Integer])

Parameters

OutStream
 Type: OutStream
An instance of the OutStream data type.

[Optional] Text
 Type: Text
The text to write. If you do not specify this, a carriage return and a line feed are written.

[Optional] Length
 Type: Integer
The number of characters to be written.

Return Value

[Optional] Written
 Type: Integer
If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.

Remarks

For more information about how zero bytes and line endings are written and read, see Write, WriteText, Read, and ReadText Method Behavior Regarding Line Endings and Zero Terminators.

Example

This example also requires that the c:\TestFiles folder exists.

var
    MyHTMLFile: File;
    TestOutStream: OutStream;
begin
    MyHTMLFile.Create('c:\TestFiles\main.html');  
    MyHTMLFile.CreateOutstream(TestOutStream);  
    TestOutStream.WriteText('<html>');  
    TestOutStream.WriteText;  
    TestOutStream.WriteText('<head>');  
    TestOutStream.WriteText('<title>My Page</title>');  
    TestOutStream.WriteText('</head>');  
    TestOutStream.WriteText;  
    TestOutStream.WriteText('<P>Hello world!</p>');  
    TestOutStream.WriteText;  
    TestOutStream.WriteText('</html>');  
    MyHTMLFile.Close;  
end;

OutStream Data Type
Get Started with AL
Developing Extensions