The following code DOES NOT WORK.saids that fprint is not formatted. any help will be thank, DO not link this to a post already posted. There is not one. and i can not find a way to make to this write to a file. it is an 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);
}
This is basic syntax error. You can always refer to man pages. Replace your fprintf
statement with this.
fprintf(out1, "%d", f);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.