Listing 4 This program uses a scanset to control the type of characters read into certain variables.

#include <stdio.h>

#define MAXLINE 80

main()
{
    char bin[MAXLINE+1];
    int n, nargs = scanf("%[01]%d",bin,&n);

    printf("nargs: %d, bin: %s, n: %d\n",nargs,bin,n);
    return 0;
}

INPUT
1011035

/*
OUTPUT
nargs: 2, bin: 10110, n: 35
*/

/* End of File */