⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scanf.3int

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 3INT
字号:
.TH scanf 3int.SH Name scanf, fscanf, sscanf \- convert formatted input.SH Syntax .B #include <stdio.h>.PP.B int scanf(.I format[,.I pointer] ....B ).br.B char .IR *format ;.PP.B int fscanf(.IR stream ,.I format[,.I pointer] ....B ).br.B FILE .IR *stream ;.br.B char.IR *format ;.PP.B int sscanf(.IR s ,.I format[, .I pointer] ....B ).br.B char.IR *s , .IR *format ;.SH Description .NXR "scanf subroutine".NXR "fscanf subroutine".NXR "sscanf subroutine".NXR "scanf subroutine" "conversion specification list"The international functions.PN scanf ,.PN fscanf ,and.PN sscanf are similar to the.PN scanfstandard I/O functions. The difference is that the internationalfunctions allow you to use the .I %digit$conversion character in place of the .I I%character you use in the standard I/O functions. The .I digitis a decimal digit.I n from 1 to 9.  The international functions apply conversions to the .I nth argument in the argument list, rather than to the next unusedargument..PPYou can use .I %conversion character in the international functions.  However, you cannotmix the .I %conversion character with the.I %digit$conversion character in a single call..PPIn all cases,.PN scanfuses the radix character and collating sequence that is defined by thelast successful call to.PN setlocalecategory.PN LC_NUMERIC or .PN LC_COLLATE .If the radix or collating sequenceis undefined, the.PN scanffunction uses the C locale definitions..SS International Environment.IP LC_COLLATE 15Contains the user requirements for language, territory, and codeset forthe character collation format. .PN LC_COLLATEaffects the behavior of regular expressions and the string collation functionsin .PN scanf .If .PN LC_COLLATEis not defined in the current environment,.PN LANGprovides the necessary default..IP LC_NUMERIC 15If this environment is set and valid, .PN scanfuses the international language database named in the definition todetermine radix character rules..IP LANG 15If this environment variable is set and valid .PN scanfuses the international language database named in the definition todetermine collation and character classification rules.  If.PN LC_NUMERICor.PN LC_COLLATE is defined,  their definitions supersede the definition ofLANG..SH Examples The following shows an example of using the.PN scanffunction:.EXscanf("%2$s %1$d", integer, string).EEIf the input is `` january 9 '', the.PN scanffunction assigns 9 to .PN integer and ``january'' to .PN string ..SH Return Values The.PN scanffunction returns the number of successfully matchedand assigned input fields.  This number can be zero if the .PN scanffunction encounters invalid input characters, as specified by theconversion specification, before it can assign input characters..PPIf the input ends before the first conflict or conversion,.PN scanfreturns EOF.These functions return EOF on end of input and a short count for missing or invalid data items..SH EnvironmentIn POSIX mode, the.BR E ,.BR F ,and.B Xformats are treated the same as the.BR e ,.BR f ,and.B xformats, respectively; otherwise, the upper-case formats expect double, double, and long arguments, respectively..SH See Also intro(3int), setlocale(3), strtod(3), strtol(3), printf(3int), getc(3s), printf(3s), scanf(3s) .br.I Guide to Developing International Software

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -