ok problem looks simple for now.
here is the text that i want to read from the file.
1 5
2
3 7
4 8
9
i had this line in the code. c=fscanf(fp,"%lf %lf
",&x,&y);
now it reads the table fine when the values are two. but it doesnt read the table properly if their is only one value in the record.
can anyone help in writing the line for scaning the record line with one value.
Comments
[code]
char line[80];
int nums[2],i;
while( fgets(line,sizeof(line),fp) )
{
char* p = strtok(line," ");
nums[0] = nums[1] = 0;
i = 0;
while(p != 0)
{
nums[i] = atoi(p);
i++;
p = strtok(NULL," ");
}
}
[/code]