After using fgets you can still use sscanf if you really want to. But writing parsing code yourself is better; user input is usually not rigidly formatted enough for the scanf family to handle it. You'll need to know about the family of functions that includes atoi() (ascii to integer).