sagar474
Full Member level 5
- Joined
- Oct 18, 2009
- Messages
- 285
- Helped
- 5
- Reputation
- 10
- Reaction score
- 5
- Trophy points
- 1,318
- Location
- India,kakinada
- Activity points
- 3,122
is there any better way to do this
I need to read a line of chars separated by space in a file.
I need to read a line of chars separated by space in a file.
Code:
while(1)
{
c=fgetc(fp);
if(c==EOF)break;
if(c!=' ')
{
a[k]=c-48;
if(c=='X' )a[k]=10;
else if(c=='/')a[k]+=48;
else if(c=='\n' ||feof(fp))
{
a[k]=11;
break;
}
++k;
}
}