summaryrefslogtreecommitdiff
path: root/student.c
diff options
context:
space:
mode:
authorClay Smith <claysmith158@gmail.com>2023-02-07 01:13:52 -0600
committerClay Smith <claysmith158@gmail.com>2023-02-07 01:13:52 -0600
commit5a6ab9faf253d3a25c559ec13db081d956fe706e (patch)
tree0567d5d914612a84f69815b6b59982870093d766 /student.c
parenta8003ca6d7c1a48ad30aa8205d352031b21e7996 (diff)
Done except fix scanf issue and add more controllers.
Diffstat (limited to 'student.c')
-rw-r--r--student.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/student.c b/student.c
index 908daa9..b0437fc 100644
--- a/student.c
+++ b/student.c
@@ -1,24 +1,18 @@
#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;
+ char buffer[100]; fgets(buffer, 99, stdin); //mandatory to fix controller programs input stream, not needed if they use fgets and sscanf instead of scanf
+
+ int num = -2, type = -2, code = -2, value = -2;
+ double time = -2;
+
+
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);
+ scanf("%d %lf %d %d %d", &num, &time, &type, &code, &value);
printf("%d, %lf, %d, %d, %d\n", num, time, type, code, value);
}
+
return 0;
}