所以这是我的代码
int main(int argc, char *argv[] )
{
double mass1, mass2, tof, pixcm;
char pofVfilename[50];
double pix[50];
double pofV[50];
if(argc != 2)
{
printf("usage: %s filename", argv[0]);
}
else
{
FILE *file = fopen(argv[1], "r");
if(file == 0){
printf("could not open file\n");
}
else{
fscanf(file, "%lf %lf", &mass1, &mass2);
fscanf(file, "%lf", &tof);
fscanf(file, "%s", pofVfilename);
fscanf(file, "%lf", &pixcm);
fclose(file);
printf("%lf%lf%lf%lf", mass1, mass2, tof, pixcm);
readinputpofV(pix, pofV, pofVfilename);
printf("%f %f", pix[10], pofV[10]);
}
}
return 0;
}
void readinputpofV(double pix[], double pofV[], char filname[]){
FILE *file = fopen(filname, "r");
if(file == 0){
printf("could not open pofV file\n");
}
else{
int result = 2;
int i = 0;
while(result == 2){
result = fscanf(file, "%lf %lf", &pix[i], &pofV[i]);
i++;
}
}
fclose(file);
}
我得到的错误是
警告:“readinputpofV”的类型冲突</p>
警告:“readinputpofV”的先前隐式声明在这里
有人可以帮忙吗。另外,我是文件输入的新手,希望能得到一些关于我如何做的指导。