I have a problem. I have a working code but I need to redesign it.

```
    #include <stdio.h>
    #include <stdlib.h>

int num_input(char *vyzva)
{
    int input;
    while (scanf("%d", &input) != 1) {
        fflush(stdin);
        printf("\nIt is not a number! Please repeat.\n\n");
        printf("%s", vyzva);
    }
    fflush(stdin);
    return input;
}

int main (void){
 int cislice;

 printf("Insert a number: ");

 cislice = num_input("Insert a number:");

 printf("Number is: %d", cislice);

return 0;
}

```

Main goal of the redesigned code is to check if the user ipnut is only number (same as working code).
I need to get this input by fgets function a then convert string to number.

For this test I can't use scanf. I was told that strtol function works for this, but I have no idea how. Can anyone show me, how to use strtol to check wether the input is number or some letters?

It's a homework.