Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/stdio/scanf.3
Show All 25 Lines | |||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" @(#)scanf.3 8.2 (Berkeley) 12/11/93 | .\" @(#)scanf.3 8.2 (Berkeley) 12/11/93 | ||||
.\" | .\" | ||||
.Dd April 2, 2022 | .Dd August 21, 2023 | ||||
.Dt SCANF 3 | .Dt SCANF 3 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm scanf , | .Nm scanf , | ||||
.Nm fscanf , | .Nm fscanf , | ||||
.Nm sscanf , | .Nm sscanf , | ||||
.Nm vscanf , | .Nm vscanf , | ||||
.Nm vsscanf , | .Nm vsscanf , | ||||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | |||||
characters, as follows: | characters, as follows: | ||||
.Bl -tag -width ".Cm l No (ell)" | .Bl -tag -width ".Cm l No (ell)" | ||||
.It Cm * | .It Cm * | ||||
Suppresses assignment. | Suppresses assignment. | ||||
The conversion that follows occurs as usual, but no pointer is used; | The conversion that follows occurs as usual, but no pointer is used; | ||||
the result of the conversion is simply discarded. | the result of the conversion is simply discarded. | ||||
.It Cm hh | .It Cm hh | ||||
Indicates that the conversion will be one of | Indicates that the conversion will be one of | ||||
.Cm dioux | .Cm bdioux | ||||
or | or | ||||
.Cm n | .Cm n | ||||
and the next pointer is a pointer to a | and the next pointer is a pointer to a | ||||
.Vt char | .Vt char | ||||
(rather than | (rather than | ||||
.Vt int ) . | .Vt int ) . | ||||
.It Cm h | .It Cm h | ||||
Indicates that the conversion will be one of | Indicates that the conversion will be one of | ||||
.Cm dioux | .Cm bdioux | ||||
or | or | ||||
.Cm n | .Cm n | ||||
and the next pointer is a pointer to a | and the next pointer is a pointer to a | ||||
.Vt "short int" | .Vt "short int" | ||||
(rather than | (rather than | ||||
.Vt int ) . | .Vt int ) . | ||||
.It Cm l No (ell) | .It Cm l No (ell) | ||||
Indicates that the conversion will be one of | Indicates that the conversion will be one of | ||||
.Cm dioux | .Cm bdioux | ||||
or | or | ||||
.Cm n | .Cm n | ||||
and the next pointer is a pointer to a | and the next pointer is a pointer to a | ||||
.Vt "long int" | .Vt "long int" | ||||
(rather than | (rather than | ||||
.Vt int ) , | .Vt int ) , | ||||
that the conversion will be one of | that the conversion will be one of | ||||
.Cm a , e , f , | .Cm a , e , f , | ||||
Show All 9 Lines | |||||
or | or | ||||
.Cm \&[ | .Cm \&[ | ||||
and the next pointer is a pointer to an array of | and the next pointer is a pointer to an array of | ||||
.Vt wchar_t | .Vt wchar_t | ||||
(rather than | (rather than | ||||
.Vt char ) . | .Vt char ) . | ||||
.It Cm ll No (ell ell) | .It Cm ll No (ell ell) | ||||
Indicates that the conversion will be one of | Indicates that the conversion will be one of | ||||
.Cm dioux | .Cm bdioux | ||||
or | or | ||||
.Cm n | .Cm n | ||||
and the next pointer is a pointer to a | and the next pointer is a pointer to a | ||||
.Vt "long long int" | .Vt "long long int" | ||||
(rather than | (rather than | ||||
.Vt int ) . | .Vt int ) . | ||||
.It Cm L | .It Cm L | ||||
Indicates that the conversion will be one of | Indicates that the conversion will be one of | ||||
.Cm a , e , f , | .Cm a , e , f , | ||||
or | or | ||||
.Cm g | .Cm g | ||||
and the next pointer is a pointer to | and the next pointer is a pointer to | ||||
.Vt "long double" . | .Vt "long double" . | ||||
.It Cm j | .It Cm j | ||||
Indicates that the conversion will be one of | Indicates that the conversion will be one of | ||||
.Cm dioux | .Cm bdioux | ||||
or | or | ||||
.Cm n | .Cm n | ||||
and the next pointer is a pointer to a | and the next pointer is a pointer to a | ||||
.Vt intmax_t | .Vt intmax_t | ||||
(rather than | (rather than | ||||
.Vt int ) . | .Vt int ) . | ||||
.It Cm t | .It Cm t | ||||
Indicates that the conversion will be one of | Indicates that the conversion will be one of | ||||
.Cm dioux | .Cm bdioux | ||||
or | or | ||||
.Cm n | .Cm n | ||||
and the next pointer is a pointer to a | and the next pointer is a pointer to a | ||||
.Vt ptrdiff_t | .Vt ptrdiff_t | ||||
(rather than | (rather than | ||||
.Vt int ) . | .Vt int ) . | ||||
.It Cm z | .It Cm z | ||||
Indicates that the conversion will be one of | Indicates that the conversion will be one of | ||||
.Cm dioux | .Cm bdioux | ||||
or | or | ||||
.Cm n | .Cm n | ||||
and the next pointer is a pointer to a | and the next pointer is a pointer to a | ||||
.Vt size_t | .Vt size_t | ||||
(rather than | (rather than | ||||
.Vt int ) . | .Vt int ) . | ||||
.It Cm q | .It Cm q | ||||
(deprecated.) | (deprecated.) | ||||
Indicates that the conversion will be one of | Indicates that the conversion will be one of | ||||
.Cm dioux | .Cm bdioux | ||||
or | or | ||||
.Cm n | .Cm n | ||||
and the next pointer is a pointer to a | and the next pointer is a pointer to a | ||||
.Vt "long long int" | .Vt "long long int" | ||||
(rather than | (rather than | ||||
.Vt int ) . | .Vt int ) . | ||||
.El | .El | ||||
.Pp | .Pp | ||||
Show All 27 Lines | |||||
.Ql % . | .Ql % . | ||||
That is, | That is, | ||||
.Dq Li %% | .Dq Li %% | ||||
in the format string | in the format string | ||||
matches a single input | matches a single input | ||||
.Ql % | .Ql % | ||||
character. | character. | ||||
No conversion is done, and assignment does not occur. | No conversion is done, and assignment does not occur. | ||||
.It Cm b , B | |||||
Matches an optionally signed binary integer; | |||||
the next pointer must be a pointer to | |||||
.Vt "unsigned int" . | |||||
.It Cm d | .It Cm d | ||||
Matches an optionally signed decimal integer; | Matches an optionally signed decimal integer; | ||||
the next pointer must be a pointer to | the next pointer must be a pointer to | ||||
.Vt int . | .Vt int . | ||||
.It Cm i | .It Cm i | ||||
Matches an optionally signed integer; | Matches an optionally signed integer; | ||||
the next pointer must be a pointer to | the next pointer must be a pointer to | ||||
.Vt int . | .Vt int . | ||||
The integer is read in base 16 if it begins | The integer is read | ||||
in base 2 if it begins with | |||||
.Ql 0b | |||||
or | |||||
.Ql 0B , | |||||
in base 16 if it begins | |||||
with | with | ||||
debdrup: Similar to the other, why a newline here? | |||||
Done Inline Actionssame reason des: same reason | |||||
.Ql 0x | .Ql 0x | ||||
or | or | ||||
.Ql 0X , | .Ql 0X , | ||||
in base 8 if it begins with | in base 8 if it begins with | ||||
.Ql 0 , | .Ql 0 , | ||||
and in base 10 otherwise. | and in base 10 otherwise. | ||||
Only characters that correspond to the base are used. | Only characters that correspond to the base are used. | ||||
.It Cm o | .It Cm o | ||||
▲ Show 20 Lines • Show All 234 Lines • Show Last 20 Lines |
Similar to the other, why a newline here?