Hey all, so I'm trying to make a program that will take user input from TerraTerm, and then echo it right back to TerraTerm. So if I typed "Hello World" and hit enter, it'd output "Hello World" at me. I'm starting from the Hello World program, so my c file started from
#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
int main()
{
init_platform();
printf("Hello, world!\n\r");
cleanup_platform();
return 0;
}
Which works just fine. I've added some lines that I found from a google search and now I have this:
#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
int main()
{
init_platform();
char command[64];
printf("Hello, world!\n\r");
printf("Type something!:\n\r");
memset(command, '\0', 64);//"reset" our holder string
int i = 0;
do{
command[i] = inbyte();
fflush(stdout);
i++;
}while(command[i-1] != '\r');//Our "command" will have a return character included at the end.
putchar(command[i]);
printf("\n");//But we still need a new line character (if we want one)
cleanup_platform();
return 0;
}
This will let me type in a user input, but when I hit enter it won't spit anything back out at me. It seems to freeze or something. Does anyone have any advice?