Changeset 65b851a
- Timestamp:
- Jan 28, 2024, 4:00:31 PM (12 months ago)
- Branches:
- master
- Children:
- 2989d6f, 7329b0a
- Parents:
- b771581
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user/user.tex
rb771581 r65b851a 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Mon Jan 22 11:59:04202414 %% Update Count : 59 6113 %% Last Modified On : Sun Jan 28 13:28:23 2024 14 %% Update Count : 5979 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 4599 4599 For example, in: 4600 4600 \begin{cfa} 4601 int i, j; 4601 4602 sin | i | ®nl® | j; 4602 4603 1 ®2® … … 4604 4605 \end{cfa} 4605 4606 variable ©i© is assigned 1, the 2 is skipped, and variable ©j© is assigned 3. 4607 For example, in: 4608 \begin{cquote} 4609 \begin{tabular}{@{}l@{\hspace{3em}}l@{}} 4610 \begin{cfa} 4611 char ch 4612 4613 sin | ch; // read X 4614 4615 X 4616 \end{cfa} 4617 & 4618 \begin{cfa} 4619 4620 sin | ®nlOn®; // enable reading newlines 4621 sin | ch; // read newline 4622 4623 4624 \end{cfa} 4625 \end{tabular} 4626 \end{cquote} 4627 the left example skips the newline and reads ©'X'© into ©ch©, while the right example reads the newline into ©ch©. 4606 4628 4607 4629 For output: … … 4942 4964 4943 4965 \item 4944 \Indexc{wdi}( maximum, reference -value)\index{manipulator!wdi@©wdi©}4945 For all types except ©char ©, maximum is the maximum number of characters read for the current operation.4966 \Indexc{wdi}( maximum, reference )\index{manipulator!wdi@©wdi©} 4967 For all types except ©char *©, maximum is the maximum number of characters read for the current operation. 4946 4968 \begin{cfa}[belowskip=0pt] 4947 char s[10]; int i; double d;4948 sin | wdi( 4, s ) | wdi( 3, i ) | wdi( 8, d ); // c == "abcd", i == 123, d == 3.456E+24969 char ch; char ca[3]; int i; double d; 4970 sin | wdi( sizeof(ch), ch ) | wdi( sizeof(ca), ca[0] ) | wdi( 3, i ) | wdi( 8, d ); // c == 'a', ca = "bcd", i == 123, d == 345.6 4949 4971 \end{cfa} 4950 4972 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] 4951 4973 ®abcd1233.456E+2® 4952 4974 \end{cfa} 4975 Here, ©ca[0]© is type ©char©, so the width reads 3 characters \Textbf{without} a null terminator. 4976 4953 4977 Note, input ©wdi© cannot be overloaded with output ©wd© because both have the same parameters but return different types. 4954 4978 Currently, \CFA cannot distinguish between these two manipulators in the middle of an ©sout©/©sin© expression based on return type.
Note: See TracChangeset
for help on using the changeset viewer.