this was a function i wrote today but it isn't working properly........it's just telling me Number 1 and 2 = 0.....can anyone run this and tweak with it and an "objects.dat" file to try to make it work?? i know it looks odd but can anyone mess with it real fast? Thanks.Code:#include <stdio.h> #include <string.h> #include <stdlib.h> int number, flag=1; int w,h,n; int tall,wide,position,x=0,y=0,a=0; char line[50],common[50]; FILE *ifp; void readfile(); main() { int x; while(x!=0) { printf("\n (1) ReadFile Function\n "); scanf("%i",&x); if (x==1) { readfile(); } } } void readfile() { if ((ifp=fopen("objects.dat", "r")) == NULL) { printf("\n * error opening file objects.dat *"); } fgets(line,100,ifp); position=(strlen(line)-1); while (position>0) { if(line[x]==' ') { number++; } position--; x++; } number+=1; x=0; while (number>0) { if(line[y]=' ') { if (flag==5) { n=atoi(common); flag+=1; common==0; x=0; number--; break; } if (flag==4) { h=atoi(common); flag+=1; common==0; x=0; number--; } if (flag==3) { w=atoi(common); flag+=1; common==0; x=0; number--; } if (flag==2) { tall=atoi(common); common==0; flag+=1; x=0; number--; break; } if (flag==1) { wide=atoi(common); flag+=1; common==0; x=0; number--; } } common[x]=line[y]; y++; x++; } printf("\n Number 1: %i",wide); printf("\n Number 2: %i\n\n\n",tall); }