diff options
author | Clay Smith <claysmith158@gmail.com> | 2023-02-05 13:50:51 -0600 |
---|---|---|
committer | Clay Smith <claysmith158@gmail.com> | 2023-02-05 13:50:51 -0600 |
commit | a8003ca6d7c1a48ad30aa8205d352031b21e7996 (patch) | |
tree | 06904f2f4e0f98417f16226fce35c6e51550ffd4 /student.c | |
parent | f54d199eb6e20fb38248d73cf83926360b6a57d2 (diff) |
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
Diffstat (limited to 'student.c')
-rw-r--r-- | student.c | 24 |
1 files changed, 24 insertions, 0 deletions
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 <stdio.h> +#include <unistd.h> +#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; +} |