瀏覽代碼

fix: 修复了log的路径错误和命令行模式问题

路径修改:
‘\’ -> ‘\\’

命令行模式下自动清除stdin的错误(ctrl+c可能会导致stdin错误)
chenping 4 年之前
父節點
當前提交
2c2bde8b18
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/virtualmath.c

+ 3 - 2
src/virtualmath.c

@@ -26,11 +26,12 @@ void runCodeStdin(Inter *inter) {
     bool should_break = false;
     setResultCore(&result);
     printf("%s", HelloString);
-    while (!should_break && !ferror(stdin) && !feof(stdin)){
+    while (!should_break){
+        if (ferror(stdin) || feof(stdin))
+            clearerr(stdin);
         fprintf(stdout, ">>> ");
         if (runParser(NULL, inter, true, &pst)) {
             globalIterStatement(&result, inter, pst);
-
             if (result.type == error_return && !(should_break = is_quitExc(result.value, inter)))
                 printError(&result, inter, true);
             freeStatement(pst);