330 lines
No EOL
6.2 KiB
HTML
330 lines
No EOL
6.2 KiB
HTML
<!DOCTYPE HTML>
|
|
<HTML LANG="en-us"
|
|
><HEAD
|
|
><TITLE
|
|
>read-byte | Common Lisp Nova Spec</TITLE
|
|
><META CHARSET="US-ASCII"
|
|
><LINK REL="canonical" HREF="f_read-byte.html"
|
|
><LINK REL="next" HREF="f_write-byte.html" TYPE="text/html" TITLE="write-byte"
|
|
><LINK REL="prev" HREF="f_streamp.html" TYPE="text/html" TITLE="streamp"
|
|
><LINK REL="up" HREF="21_2_Streams_Dictionary.html" TYPE="text/html" TITLE="21.2 Streams Dictionary"
|
|
><LINK REL="start" HREF="index.html" TYPE="text/html" TITLE="Common Lisp Nova Spec"
|
|
><META NAME="VIEWPORT" CONTENT="width=device-width, initial-scale=1.0"
|
|
><LINK REL="STYLESHEET" HREF="dpans.css%3F3909942064.css"
|
|
><SCRIPT SRC="dpans.js%3F3909942064"
|
|
></SCRIPT
|
|
><SCRIPT SRC="apropos.js%3F3909942064"
|
|
></SCRIPT
|
|
></HEAD
|
|
><BODY
|
|
><DIV
|
|
><DIV CLASS="topnav"
|
|
><DIV CLASS="breadcrumb"
|
|
><SPAN CLASS="breadcrumb-item"
|
|
><A HREF="index.html"
|
|
>Common Lisp Nova Spec</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="21_Streams.html"
|
|
>21. Streams</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="21_2_Streams_Dictionary.html"
|
|
>21.2 Streams Dictionary</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="f_read-byte.html"
|
|
>read-byte</A
|
|
></SPAN
|
|
></DIV
|
|
><DIV CLASS="apropos"
|
|
><DIV CLASS="apropos-io"
|
|
><A HREF="f_streamp.html" CLASS="prev"
|
|
>←</A
|
|
><SPAN ID="apropos-label"
|
|
>Apropos </SPAN
|
|
><INPUT ID="apropos" AUTOFOCUS="AUTOFOCUS" PLACEHOLDER="Type here to search" ONINPUT="aproposInput(this);" ONKEYUP="aproposKeyup(event);" ONCHANGE="aproposChange(this);" ONFOCUS="aproposFocus(this);" ONFOCUSOUT="aproposFocusout(this);"
|
|
><A HREF="f_write-byte.html" CLASS="next"
|
|
>→</A
|
|
></DIV
|
|
><DIV ID="apropos-res"
|
|
></DIV
|
|
></DIV
|
|
></DIV
|
|
><DIV CLASS="matter"
|
|
><DIV CLASS="com"
|
|
><DIV CLASS="begincom"
|
|
><HR
|
|
><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" WIDTH="100%" CLASS="name"
|
|
><SPAN CLASS="idx" DATA-KIND="idxref" DATA-TERM="read-byte"
|
|
></SPAN
|
|
><B
|
|
>read-byte</B
|
|
></TD
|
|
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
|
|
><I
|
|
>Function</I
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
></DIV
|
|
><UL CLASS="subtoc"
|
|
></UL
|
|
><DL
|
|
><DT
|
|
><B
|
|
>Syntax</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
><B
|
|
>read-byte</B
|
|
> <SPAN CLASS="cmssi"
|
|
>stream</SPAN
|
|
> <SPAN CLASS="cmtt"
|
|
>&optional</SPAN
|
|
> <SPAN CLASS="cmssi"
|
|
>eof-error-p</SPAN
|
|
> <SPAN CLASS="cmssi"
|
|
>eof-value</SPAN
|
|
> <SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
> <SPAN CLASS="cmssi"
|
|
>byte</SPAN
|
|
></P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Arguments and Values</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
><VAR CLASS="param"
|
|
>stream</VAR
|
|
> — a <A HREF="26_1_Glossary.html#binary"
|
|
><EM CLASS="term"
|
|
>binary</EM
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#input"
|
|
><EM CLASS="term"
|
|
>input</EM
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#stream"
|
|
><EM CLASS="term"
|
|
>stream</EM
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
><VAR CLASS="param"
|
|
>eof-error-p</VAR
|
|
> — a <A HREF="26_1_Glossary.html#generalized_boolean"
|
|
><EM CLASS="term"
|
|
>generalized boolean</EM
|
|
></A
|
|
>. The default is <A HREF="26_1_Glossary.html#true"
|
|
><EM CLASS="term"
|
|
>true</EM
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
><VAR CLASS="param"
|
|
>eof-value</VAR
|
|
> — an <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>object</EM
|
|
></A
|
|
>. The default is <SPAN CLASS="misc"
|
|
><B
|
|
>nil</B
|
|
></SPAN
|
|
>. </P
|
|
><P CLASS="j"
|
|
><VAR CLASS="param"
|
|
>byte</VAR
|
|
> — an <A HREF="26_1_Glossary.html#integer"
|
|
><EM CLASS="term"
|
|
>integer</EM
|
|
></A
|
|
>, or the <VAR CLASS="param"
|
|
>eof-value</VAR
|
|
>.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Description</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
><A HREF="f_read-byte.html" CLASS="funref"
|
|
><B
|
|
>read-byte</B
|
|
></A
|
|
> reads and returns one byte from <VAR CLASS="param"
|
|
>stream</VAR
|
|
>. </P
|
|
><P CLASS="j"
|
|
>If an <A HREF="26_1_Glossary.html#end_of_file"
|
|
><EM CLASS="term"
|
|
>end of file</EM
|
|
></A
|
|
><SPAN CLASS="meaning"
|
|
><SUB CLASS="sub"
|
|
><SPAN CLASS="cmr"
|
|
>2</SPAN
|
|
></SUB
|
|
></SPAN
|
|
> occurs and <VAR CLASS="param"
|
|
>eof-error-p</VAR
|
|
> is <A HREF="26_1_Glossary.html#false"
|
|
><EM CLASS="term"
|
|
>false</EM
|
|
></A
|
|
>, the <VAR CLASS="param"
|
|
>eof-value</VAR
|
|
> is returned.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Examples</B
|
|
></DT
|
|
><DD
|
|
><PRE CLASS="screen"
|
|
> (with-open-file (s "temp-bytes"
|
|
:direction :output
|
|
:element-type 'unsigned-byte)
|
|
(write-byte 101 s)) <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> 101
|
|
(with-open-file (s "temp-bytes" :element-type 'unsigned-byte)
|
|
(format t "~S ~S" (read-byte s) (read-byte s nil 'eof)))
|
|
<SPAN CLASS="cmr"
|
|
>⊳</SPAN
|
|
> 101 EOF
|
|
<SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> NIL</PRE
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Side Effects</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>Modifies <VAR CLASS="param"
|
|
>stream</VAR
|
|
>.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Exceptional Situations</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>Should signal an error of <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
> <A HREF="t_type-error.html" CLASS="typeref"
|
|
><B
|
|
>type-error</B
|
|
></A
|
|
> if <VAR CLASS="param"
|
|
>stream</VAR
|
|
> is not a <A HREF="26_1_Glossary.html#stream"
|
|
><EM CLASS="term"
|
|
>stream</EM
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
>Should signal an error of <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
> <A HREF="t_error.html" CLASS="typeref"
|
|
><B
|
|
>error</B
|
|
></A
|
|
> if <VAR CLASS="param"
|
|
>stream</VAR
|
|
> is not a <A HREF="26_1_Glossary.html#binary"
|
|
><EM CLASS="term"
|
|
>binary</EM
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#input"
|
|
><EM CLASS="term"
|
|
>input</EM
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#stream"
|
|
><EM CLASS="term"
|
|
>stream</EM
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
>If there are no <A HREF="26_1_Glossary.html#byte"
|
|
><EM CLASS="term"
|
|
>bytes</EM
|
|
></A
|
|
> remaining in the <VAR CLASS="param"
|
|
>stream</VAR
|
|
> and <VAR CLASS="param"
|
|
>eof-error-p</VAR
|
|
> is <A HREF="26_1_Glossary.html#true"
|
|
><EM CLASS="term"
|
|
>true</EM
|
|
></A
|
|
>, an error of <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
> <A HREF="t_end-of-file.html" CLASS="typeref"
|
|
><B
|
|
>end-of-file</B
|
|
></A
|
|
> is signaled.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>See Also</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
><A HREF="f_read-char.html" CLASS="funref"
|
|
><B
|
|
>read-char</B
|
|
></A
|
|
>, <A HREF="f_read-sequence.html" CLASS="funref"
|
|
><B
|
|
>read-sequence</B
|
|
></A
|
|
>, <A HREF="f_write-byte.html" CLASS="funref"
|
|
><B
|
|
>write-byte</B
|
|
></A
|
|
></P
|
|
></DD
|
|
></DL
|
|
></DIV
|
|
></DIV
|
|
><DIV CLASS="footer"
|
|
><DIV CLASS="btmnav"
|
|
><A HREF="f_streamp.html" CLASS="prev"
|
|
>←</A
|
|
><A HREF="f_write-byte.html" CLASS="next"
|
|
>→</A
|
|
></DIV
|
|
><DIV CLASS="trail"
|
|
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
|
|
></DIV
|
|
></DIV
|
|
><SCRIPT
|
|
>domReady();</SCRIPT
|
|
></BODY
|
|
></HTML
|
|
> |