Change input from scanf() to getchar() !

This commit is contained in:
lux 2017-08-14 02:38:31 +02:00
parent caf2b81431
commit c9b291ce38
1 changed files with 7 additions and 4 deletions

View File

@ -15,7 +15,7 @@ int main(int argc, char *argv[])
uint8_t op_code;
uint16_t pc = 0;
int data_addr=0;
char quit;
int quit='n';
bool run = true;
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
else pc++;
printf("(n)ext step or (q)uit or (c)oredump ?\n");
scanf("%c",&quit);
if(quit == 'c') makeHexDump(true,ram);
else if(quit == 'q') run = false;
while((quit = getchar()) != '\n' && quit != EOF)
{
if(quit == 'c') makeHexDump(true,ram);
else if(quit == 'q') run = false;
}
}