INFO: scanf() Format Specifications and Syntax (67879)
The information in this article applies to:
- The C Run-Time (CRT), when used with:
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 5.0
This article was previously published under Q67879 SUMMARY
In Microsoft C, the scanf() format specifier for a string is generally
specified with the "%s" specifier. However, "%s" is a shorthand notation
for the specifier that the run-time library actually uses.
Because "%s" causes the library to read the input string until it finds
some white space, the equivalent format specifier is "%[^\0x20\t\n]", which
instructs the library to read the string until it encounters a space
character (\0x20), a tab character (\t), or a newline character (\n).
Modification Type: | Major | Last Reviewed: | 12/12/2003 |
---|
Keywords: | kbCRT kbinfo KB67879 kbAudDeveloper |
---|
|