64,637
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <sys/uio.h>
int main()
{
char msg[50]={0};
FILE* filefd;
int wrflag=0;
if((filefd=fopen("tmp.txt","a+"))==NULL)
{
printf("creat file is err!\n");
return 0;
}
fgets(msg,50,filefd);
// fflush(filefd);
char *p;
char s[]=" ";
printf("%s",strtok(msg,s));
while((p=strtok(NULL,s)))
printf("%s",p);
fclose(filefd);
return 0;
}
修改下就可以使用了
FILE *fp;
int a;
int b;
double c;
fscanf(fp,"%d %d %lf",a,&b,&c)