Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File C使用/a.out读取文件<;文件名和如何停止读取_File - Fatal编程技术网

File C使用/a.out读取文件<;文件名和如何停止读取

File C使用/a.out读取文件<;文件名和如何停止读取,file,File,在我今天的课上,我们被分配了一个项目,涉及使用./a.out“%d\n”,num)读取文件; 返回0; } 我也有同样的问题。尝试了我能找到的所有方法来吃掉缓冲区中剩余的输入,但它永远不会结束 使用fopen和fscanf使其工作,但教授说他更喜欢使用a.out

在我今天的课上,我们被分配了一个项目,涉及使用./a.out“%d\n”,num)读取文件; 返回0; }
我也有同样的问题。尝试了我能找到的所有方法来吃掉缓冲区中剩余的输入,但它永远不会结束


使用fopen和fscanf使其工作,但教授说他更喜欢使用a.out的代码。事实证明这是不可能的。

想知道我们在同一所学校的机会有多大?不管怎样,我给我的教授发了电子邮件,我认为不可能使用这个命令。当我得到答复时,我会告诉你他告诉我什么。
16915  46.25  32  32
10492  34.05  56  52
10027  98.53  94  44
13926  32.94  19  65
15736  87.67  5  1
16429  31.00  58  25
15123  49.93  65  38
19802  37.89  10  20
-1 
-1 0 0 0
#include <stdio.h>

int main(void)
{
        int i = 0,j = 1,d,euid[200],num;
        int tester = 0;
        float hw[200],ex1[200],ex2[200];
        while(j)
        {
                scanf("%d",&tester);
                if( tester == -1)
                {
                        j = 0;
                }
                else
                {
                        euid[i] = tester;
                }
                scanf("%f",hw+i);
                scanf("%f",ex1+i);
                scanf("%f",ex2+i);
                i++;
        }
        for(d = 0;d < 50;d++) /*50 because the actual file size contains much more than example*/
        {
                printf("euid = %d\n",euid[d]);
                printf("hw = %f\n",hw[d]);
                printf("ex1 = %f\n",ex1[d]);
                printf("ex2 = %f\n",ex2[d]);
        }
        printf("input something user\n");
        scanf("%d",&num);
        printf("This is what is being printed out -> %d\n",num);
return 0;
}