以下代码无效:表示未格式化fprint。感谢您的任何帮助,请勿将其链接到已发布的帖子。没有一个。而且我找不到这种写入文件的方法。它是一个int。
void print(int number, int readpfd)
{
FILE *out1;
out1 = fopen("outfile.txt","w");
int i;
int f;
char file_name[42];
char cover[42];
for( i = 0; i < number; i++ )
{
read(readpfd, &f, sizeof(int));
fprintf("out1, %d\n", f); //this is the line that wrong
}
close(readpfd);
fclose(out1);
}
最佳答案
这是基本语法错误。您始终可以参考手册页。以此替换您的fprintf
语句。
fprintf(out1, "%d", f);
关于c - 用C将Int写入文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32772076/