64,282
社区成员
发帖
与我相关
我的任务
分享
FILE *file=fopen("D:\\tt.txt","r");
char str[100];
fgets(str,99,file);
fseek(file,0,0);
int lenth=strlen(str)*3; //获取每行的字节数*行数
fseek(file,lenth,0); //指针偏移量
Struct_PT temp1; //一个结构体
fscanf(file,"%f,%f,%f,%d,%d,%d,%f\n",&temp1.x,&temp1.y,&temp1.z,&temp1.r,&temp1.g,&temp1.b,&temp1.i);
float xx=temp1.x;
float yy=temp1.y;
float zz=temp1.z;
int rr=temp1.r;
int gg=temp1.g;
int bb=temp1.b;
float ii=temp1.i;
每行定长的写入文件呗!