<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css">
<title>
Gambas Documentation - WRITE
</title>
</head>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../help+en"><img class="flag" alt="Home" border="0" src="../../img/lang/en.png" align="center"></a>&nbsp;
<a href="../lang+en">Up</a>&nbsp;
<a href="with+en">Previous</a>&nbsp;
<a href="xor+en">Next</a>&nbsp;
</td></tr></table>
<div class="notab">
<h1>
WRITE
</h1>
<div class="black"><font size="-2"><b>Syntax</b></font></div>
<pre class="syntax"><b>WRITE</b> [ <b>#</b> <u>Stream</u> <b>,</b> ] <u>Expression</u> [ <b>,</b> <u>Length</u> ]
<b>WRITE</b> [ <b>#</b> <u>Pointer</u> <b>,</b> ] <u>Expression</u> [ <b>,</b> <u>Length</u> ]</pre><p>

Writes an expression to the <a href="../def/stream+en">stream</a> <u>Stream</u> by using their binary representation.
<p>
If the <a href="../def/stream+en">stream</a> is not specified, the standard output is used.
<p>
If <u>Expression</u> is a string, you can specify a length that indicates the number of bytes to write. If no length is specified for a string, it is directly written to the <a href="../def/stream+en">stream</a> just before the string data.
<p>
<div class="warning"><table class="none" border="0"><tr><td width="40" valign="top"><img border="0" src="../../img/info.png" align="center"></td><td valign="top">
This instruction uses the byte order of the <a href="../def/stream+en">stream</a> to read the data.
</td></tr></table></div>
<p>
If you specify a <a href="type/pointer+en">Pointer</a> instead of a <a href="../comp/gb/stream+en">Stream</a>, then data will be written directly to
the memory address specified by the pointer.
<p>
<div class="warning"><table class="none" border="0"><tr><td width="40" valign="top"><img border="0" src="../../img/info.png" align="center"></td><td valign="top">
If you try to write at a forbidden memory address, you will get an error. The interpreter won't crash.
</td></tr></table></div>
<p>
<hr><b>See also</b><br>
<a href="../cat/stream+en">Stream &amp; Input/Output functions</a>&nbsp; <a href="../comp/gb/stream/byteorder+en">Stream.ByteOrder</a>&nbsp; <a href="datarep+en">Binary Data Representation</a>&nbsp; <a href="../cat/extern+en">External Function Management</a>&nbsp;

</div>
</body>
</html>

