The fscanf() function parses input from an open file according to a specified format.
fscanf(file,format,mixed)
parameter | describe |
---|---|
file | Required. Specifies the documents to be checked. |
format | Required. Specify the format. Possible format values: %% - returns a percent sign % %b - binary number %c - the character corresponding to the ASCII value %d - a decimal number with a positive or negative sign %e - scientific notation (for example: 1.2e+2) %u - Decimal number without sign %f - floating point number (local property) %F - floating point number (non-native property) %o - decimal number %s - string %x - hexadecimal number (lowercase letters) %X - hexadecimal number (uppercase letters) Additional format values. Must be placed between % and a letter (e.g. %.2f): + (Add + or - in front of a number to define the sign of the number. By default, only negative numbers are marked, and positive numbers are not marked) ' (Specifies what to use as padding, defaults to spaces. It must be used with a width specifier. For example: %'x20s (use "x" as padding)) - (left adjustment variable value) [0-9] (specifies the minimum width of the variable value) .[0-9] (specifies the number of decimal places or the maximum string length) Note: If multiple above format values are used, they must be used in the order above and cannot be disrupted. |
mixed | Optional. |
Note: Any whitespace in the format string will match any whitespace in the input stream. This means that the tab character t in the format string will also match a single space character in the input stream.