For example:
Code:
#include <stdio.h>
int main(void)
{
char base;
char number_in_base[5];
char input[] = "H1234";
if (sscanf(input, "%c%4s", &base, number_in_base) == 2)
{
printf("base: %c; number in base: %s\n", base, number_in_base);
}
else
{
fprintf(stderr, "The input was invalid.\n");
}
return 0;
}
So, with %c, I read a character, then with %4s, I read the rest, up to 4 characters since the destination array can only store 5 characters (i.e., one is reserved for the null character).
There are other ways by which you might do this, e.g., use getchar or something similiar for that one character, then maybe fgets for the rest.