treesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorPatrick2023-08-02 23:47:20 +0200
committerPatrick2023-08-02 23:47:20 +0200
commit4732c7322c4af189232d5faee94e43fe71b175d2 (patch)
tree6ba8274edc14cb31a092f45dbb6e73dae3878c36
parentb836e0a4630c9cf8c098b18bca83a3323e181b7f (diff)
downloadiftint-4732c7322c4af189232d5faee94e43fe71b175d2.tar.gz
iftint-4732c7322c4af189232d5faee94e43fe71b175d2.zip
fix peekchar input
-rw-r--r--main2.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/main2.c b/main2.c
index 5ea32ef..104c2a4 100644
--- a/main2.c
+++ b/main2.c
@@ -14,7 +14,7 @@
#define NEWARR(TYPE, NUM) ((TYPE *)calloc(NUM, sizeof(TYPE)))
-// getch()
+// getch
#ifdef _WIN32
#include <windows.h>
@@ -279,8 +279,8 @@ GetChar() {
int
PeekChar() {
- int c = GetChar();
- ungetch(c);
+ Draw();
+ int c = peekch();
return c;
}
@@ -354,20 +354,20 @@ GetNode(JSONNode * parent) {
}
case 'o': {
result->kind = JSONNodeKind_Obj;
- while ((c = peekch()), (c != '\r') && (c != '\n')) {
+ while ((c = PeekChar()), (c != '\r') && (c != '\n')) {
JSONNodePush(result, JSONNodeNewStr(GetStr()));
JSONNodePush(result, GetNode(result));
}
- getch();
+ GetChar();
break;
}
case 'a': {
result->kind = JSONNodeKind_Arr;
- while ((c = peekch()), (c != '\r') && (c != '\n')) {
+ while ((c = PeekChar()), (c != '\r') && (c != '\n')) {
JSONNodePush(result, GetNode(result));
}
- getch();
+ GetChar();
break;
}
case 8: