Changeset 795500c3


Ignore:
Timestamp:
Jun 29, 2023, 9:58:42 PM (12 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
48ee593
Parents:
af5cfad6
Message:

update documentation for stream input and output

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/user/user.tex

    raf5cfad6 r795500c3  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Thu Jun 29 11:53:10 2023
    14 %% Update Count     : 5523
     13%% Last Modified On : Thu Jun 29 21:52:51 2023
     14%% Update Count     : 5533
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    39913991\end{cfa}
    39923992\begin{cfa}[showspaces=true,aboveskip=0pt]
    3993 1®, $\LstStringStyle{\textdollar}$®2®, $\LstStringStyle{\textdollar}$®3 ®", $\LstStringStyle{\textdollar}$"®
     39931®, $\color{red}\LstStringStyle{\textdollar}$®2®, $\color{red}\LstStringStyle{\textdollar}$®3 ®", $\color{red}\LstStringStyle{\textdollar}$"®
    39943994\end{cfa}
    39953995\begin{cfa}[belowskip=0pt]
     
    40404040\Indexc{sepOff}\index{manipulator!sepOff@©sepOff©} and \Indexc{sepOn}\index{manipulator!sepOn@©sepOn©} globally toggle printing the separator.
    40414041\begin{cfa}[belowskip=0pt]
    4042 sout | sepOff | 1 | 2 | 3; $\C{// turn off implicit separator}$
     4042sout | ®sepOff® | 1 | 2 | 3; $\C{// turn off implicit separator}$
    40434043\end{cfa}
    40444044\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    40464046\end{cfa}
    40474047\begin{cfa}[belowskip=0pt]
    4048 sout | sepOn | 1 | 2 | 3; $\C{// turn on implicit separator}$
     4048sout | ®sepOn® | 1 | 2 | 3; $\C{// turn on implicit separator}$
    40494049\end{cfa}
    40504050\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    40554055\Indexc{sep}\index{manipulator!sep@©sep©} and \Indexc{nosep}\index{manipulator!nosep@©nosep©} locally toggle printing the separator with respect to the next printed item, and then return to the global separator setting.
    40564056\begin{cfa}[belowskip=0pt]
    4057 sout | 1 | nosep | 2 | 3; $\C{// turn off implicit separator for the next item}$
     4057sout | 1 | ®nosep® | 2 | 3; $\C{// turn off implicit separator for the next item}$
    40584058\end{cfa}
    40594059\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    40614061\end{cfa}
    40624062\begin{cfa}[belowskip=0pt]
    4063 sout | sepOff | 1 | sep | 2 | 3; $\C{// turn on implicit separator for the next item}$
     4063sout | sepOff | 1 | ®sep® | 2 | 3; $\C{// turn on implicit separator for the next item}$
    40644064\end{cfa}
    40654065\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    40684068The tuple separator also responses to being turned on and off.
    40694069\begin{cfa}[belowskip=0pt]
    4070 sout | t1 | nosep | t2; $\C{// turn off implicit separator for the next item}$
     4070sout | t1 | ®nosep® | t2; $\C{// turn off implicit separator for the next item}$
    40714071\end{cfa}
    40724072\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    40764076use ©sep© to accomplish this functionality.
    40774077\begin{cfa}[belowskip=0pt]
    4078 sout | sep | 1 | 2 | 3 | sep; $\C{// sep does nothing at start/end of line}$
     4078sout | ®sep® | 1 | 2 | 3 | ®sep®; $\C{// sep does nothing at start/end of line}$
    40794079\end{cfa}
    40804080\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    40824082\end{cfa}
    40834083\begin{cfa}[belowskip=0pt]
    4084 sout | sep | 1 | 2 | 3 | sep ; $\C{// use sep to print separator at start/end of line}$
     4084sout | ®sepVal® | 1 | 2 | 3 | ®sepVal® ; $\C{// use sepVal to print separator at start/end of line}$
    40854085\end{cfa}
    40864086\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    41164116\Indexc{nl}\index{manipulator!nl@©nl©} inserts a newline.
    41174117\begin{cfa}
    4118 sout | nl; $\C{// only print newline}$
     4118sout | ®nl®; $\C{// only print newline}$
    41194119sout | 2; $\C{// implicit newline}$
    4120 sout | 3 | nl | 4 | nl; $\C{// terminating nl merged with implicit newline}$
    4121 sout | 5 | nl | nl; $\C{// again terminating nl merged with implicit newline}$
     4120sout | 3 | ®nl® | 4 | ®nl®; $\C{// terminating nl merged with implicit newline}$
     4121sout | 5 | ®nl® | ®nl®; $\C{// again terminating nl merged with implicit newline}$
    41224122sout | 6; $\C{// implicit newline}$
    41234123
     
    42864286For the C-string type, precision is the maximum number of printed characters, so the string is truncated if it exceeds the maximum.
    42874287\begin{cfa}[belowskip=0pt]
    4288 sout | wd( 6,8, "abcd" ) | wd( 6,8, "abcdefghijk" ) | wd( 6,3, "abcd" );
     4288sout | wd( 6,8, "abcd" ) | wd( 6,8, "abcdefghijk" ) | wd( 6,3, "abcd" ) | ®wd( 10, "" )® | 'X';
    42894289\end{cfa}
    42904290\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
    4291   abcd abcdefgh    abc
    4292 \end{cfa}
     4291  abcd abcdefgh    abc®          ®X
     4292\end{cfa}
     4293Note, printing the null string with minimum width L pads with L spaces.
    42934294
    42944295\item
     
    46924693        sout  | i | j | k | x | y | s;
    46934694}
    4694 
     4695\end{cfa}
     4696\begin{cfa}[showspaces=true]
    469546973 0x5          7 1.234568e+07 987.654n abc
    469646983 0x5          7 1.234568e+07 987.654n abc
Note: See TracChangeset for help on using the changeset viewer.