This turns out to be a very direct question, and it was definitely received by Charles and published before me. But they did not mention where you should look for such things the next time you get stuck.
first the question is - fscanf belongs to the family of built-in input (scan) functions that should read the input data and report some information about the data read as bytes, or the number of elements (address variables) that received the appropriate input reading and had a successful assignment.
here fscanf should check for matches in the input file with the format string provided in the function call, and accordingly assign (in the order of their position) the address variable with the value and, after its completion, returns, count the number of successful jobs that he did. therefore, result 1 and the next was 4 (provided that the input was provided properly).
second part: where to look? - Well-described details for such a function can easily be found in your manual pages or posix doc if you link to one.
if you noticed, the previous two answers also contain small excerpts from the man pages.
hope this helps.
nsd
source share