Here is a data file like this,please help me update my code to omit all comments stored in the file.sample file looks like this:
C:\\s1.txt
#author:Single Ray
#data:02-2-10
141.641, 567.614, 24.25
140.939, 567.736, 24.25 #start
140.053, 567.947, 24.25
148.985, 568.352, 24.25 #end
....
Im sorry,forgot attach my codes,here is my code which could only import data lines have no comments!!Please help me out!!
#include "stdio.h"
void main()
{
int i=0;
char pound; //still working on omit those comments
double a[143][2];
FILE *fp;
fp=fopen("s1.txt","r");
if(fp==NULL) {
printf("Error: can't open file.\n");
return 1;
}
else {
printf("File opened successfully. Contents:\n\n");
while(!feof(fp))
{
for(i=0;i<144;i++){
fscanf(fp,"%lf%*s%lf%*s%lf\n",&a[i][0],&a[i][1],&a[i][2]);
printf("(%lf, %lf, %lf)\n",a[i][0],a[i][1],a[i][2]);
}
}
fclose(fp);
return 0;
}
}