void
read_stdin(trace_t* trace, state_t state, action_t** action_list) {
// initial stage
int c;
while ((c = getchar())!= EOF && c!='#') {
if (my_isalpha(c)==LOWERCASE) {
state[c-ASCII_CODE_LOWER_A] = '1';
}
}
printf("%s\n", state);
char str[2];
fgets(str, 2, stdin);
printf("%s", str);
}
If '#' is the last character I enter in the getchar() loop, fgets() records the newline character from when I press enter and skips to the print statement immediately (which prints the '\n')
I could fix this by adding an additional fgets()(which has to have a string that is longer than 1 char passed to it for some reason?) but is there a more elegant way of solving this?