<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css">
<title>
Gambas Documentation - WRITE
</title>
</head>
<body>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../help%3Fen"><img class="flag" alt="Home" border="0" src="../../img/lang/en.png" align="center"></a>&nbsp;&nbsp;
<a href="../lang%3Fen">Up</a>&nbsp;&nbsp;
<a href="with%3Fen">Previous</a>&nbsp;&nbsp;
<a href="xor%3Fen">Next</a>&nbsp;&nbsp;
</td></tr></table>
<div class="notab">
<h1>
WRITE
</h1>
<div class="black"><font color="white" 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%3Fen">stream</a> <u>Stream</u> by using their binary representation.
<p>
If the <a href="../def/stream%3Fen">stream</a> is not specified, the standard output is used.
<p>
If <u><a href="../comp/gb.eval/expression%3Fen">Expression</a></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%3Fen">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%3Fen">stream</a> to read the data.
</td></tr></table></div>
<p>
If you specify a <a href="type/pointer%3Fen">Pointer</a> instead of a <a href="../comp/gb/stream%3Fen">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%3Fen">Stream &amp; Input/Output functions</a>&nbsp;&nbsp; Stream.<a href="../comp/gb/stream/byteorder%3Fen">ByteOrder</a>&nbsp;&nbsp; <i>/lang/datarep</i> <a href="../cat/extern%3Fen">External Function Management</a>&nbsp;&nbsp;

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

