c - 错误 :expected ':' , ',' 或“)' before '”。代币

标签 c

我收到错误 error:expected ':', ',' or')' before '.' token在以下代码中:

#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>

void filecopy(FILE*,FILE*);

int main()
{
    FILE*fpin,*fpout;

    fpin = fopen("file_a.dat", "r");//
    fpout = fopen("file_b.dat", "w");
    filecopy(fpin, fpout);
    fclose ( fpin );
    fclose  ( fpout );

}

void filecopy(FILE*fpin.FILE*fpout)//(FILE*fpin,FILE*fpout)
{
    char ch;

    ch = getc (fpin);

    while (!feof(fpin));//delete the ';'
    {
        putc (ch,fpout);
        ch = getc (fpin);
    }
}

PS:再次,我很抱歉我的仓促而无意义的问题。这要怪我粗心的编码习惯,不要再想了。我会注意在stackoverflow上提问。但我还是想对回答和评论的人表示感谢。

最佳答案

两个错误:

1.替换行:

while (!feof(fpin));

与:

while (!feof(fpin))       //without semicolon (;)

2.替换行:

void filecopy(FILE *fpin.FILE *fpout);

与:

void filecopy(FILE *fpin, FILE *fpout)

关于c - 错误 :expected ':' , ',' 或“)' before '”。代币,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42205812/

相关文章:

c - 帮助您进行 C 开发的分析工具

c - Windows 条件变量与事件

c - 对 BST 中的偶数求和

c - 限制真实(固定/浮点)值的最快方法?

c - 无法在头指针指向c的地方创建新节点?

我可以在临时结果中溢出 uint32_t 吗?

c - for循环的matlab代码

c - fgets 返回更少的字符

c - 使用 fopen 时出现段错误

c - Xenomai 中的周期性线程实时失败