Change input from scanf() to getchar() !

This commit is contained in:
lux 2017-08-14 02:38:31 +02:00
parent caf2b81431
commit c9b291ce38

View File

@ -15,7 +15,7 @@ int main(int argc, char *argv[])
uint8_t op_code; uint8_t op_code;
uint16_t pc = 0; uint16_t pc = 0;
int data_addr=0; int data_addr=0;
char quit; int quit='n';
bool run = true; bool run = true;
if(initialise_ram(ram,argc,argv)==-1) return 1; if(initialise_ram(ram,argc,argv)==-1) return 1;
@ -33,9 +33,12 @@ int main(int argc, char *argv[])
pc=find_data(ram[pc]); //jump if ACCU is ZERO pc=find_data(ram[pc]); //jump if ACCU is ZERO
else pc++; else pc++;
printf("(n)ext step or (q)uit or (c)oredump ?\n"); printf("(n)ext step or (q)uit or (c)oredump ?\n");
scanf("%c",&quit); while((quit = getchar()) != '\n' && quit != EOF)
if(quit == 'c') makeHexDump(true,ram); {
else if(quit == 'q') run = false; if(quit == 'c') makeHexDump(true,ram);
else if(quit == 'q') run = false;
}
} }