I just started learning C, so please bear with my if my code is not all that great! So I am basically trying to print out "Start Typing >" utilizing lc4_puts(). Then I am trying to fall into a loop where it waits for me to type a character and then prints that character to the console. The program terminates when it encounters a line feed character char '/n'. My code is compiling, but not giving the desired result. "Start Typing >" prints to the screen, but I cannot type after that.
Code:
#include "os_trap_wrappers.h"
// set the size of the character array input
#define STRING_SIZE 100
int main(void)
{
char c, input[STRING_SIZE];
int i;
lc4_puts("Start Typing >");
for (i = 0; (c = lc4_getc()) != '\n'; ++i) {
input[i] = c;
}
input[i] = '\0';
lc4_putc(input[i]);
return 0;
}
and this is my os wrapper code
Code:
char lc4_getc();void lc4_putc(char c);
void lc4_puts(char *str);
void lc4_draw_box(int x, int y, int size, int *colors);
any help would be greatly appreciated!