fscanf works with a file pointer. It doesn't know or care what the extension was in the name used in the fopen statement. It doesn't even care if the data can be parsed according to the user's wishes. If it can, it returns the values. If it can't it fails and returns an appropriate indication.

There is an implication that MAXNUM is the number of records (lines) to read. It could be arbitrarily determined or it could be determined by counting the number of lines in the file. Presumably (to avoid boundary overflows and crashes), it relates to the lengths of the arrays set aside for the data.

Please do not make suggestions based on unfounded impressions you might hold, or admittedly don't know (.txt vs. .dat). That is no help to the OP and might introduce unnecessary complications.