From a8003ca6d7c1a48ad30aa8205d352031b21e7996 Mon Sep 17 00:00:00 2001 From: Clay Smith Date: Sun, 5 Feb 2023 13:50:51 -0600 Subject: Now working with scanf properly on my end. Run the program without arguments to get devices connected, run with the number to run that device --- student.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 student.c (limited to 'student.c') diff --git a/student.c b/student.c new file mode 100644 index 0000000..908daa9 --- /dev/null +++ b/student.c @@ -0,0 +1,24 @@ +#include +#include +#include "user_defs.h" + +int main(void) +{ + char buffer[100]; + int num = -1, type = -1, code = -1, value = -1; + double time = -1; + int scan = -2; + char c; + while (1) { + fgets(buffer, 99, stdin); + //printf("%s", buffer); + //if (buffer[0] == '1') { + // printf("first value is 1\n"); + // } + // scan = sscanf(buffer, "%d %lf %d %d %d\n", &num, &time, &type, &code, &value); + // printf("%d\n", scan); + scanf("%d %lf %d %d %d\n", &num, &time, &type, &code, &value); + printf("%d, %lf, %d, %d, %d\n", num, time, type, code, value); + } + return 0; +} -- cgit v1.2.1