I'm very new to C and I'm learning about file IO. Right now I'm trying to read from a txt file and I know that the first thing in the txt file is some number, as large as the largest possible int value. I think I'm missing something because what I'm attempting to do is input it, with either fgets or multiple fgetc 's. Then I convert each individual byte or ASCII code to an integer, and by counting how many I read in, I can multiply each one by its respective weight and add them to produce the actual integer I'm after. This just seems overly complicated and I feel as though I'm missing a much easier way.
So my question reduces to:
What is the best way to read a multi-digit integer from a txt file and have the integer available to work with in one's program?