[code]
#include <stdio.h>
#include <string.h>
main()
{
int tall,wide,size,x=0;
char line[100],temp[100];
FILE *ifp;
printf("\n\n Opening OBJECT.DAT ");
if ((fopen("object.dat", "r")) == NULL)
{
printf("\n error opening file object.dat ");
}
size=strlen(line);
printf("\n %s",line);
}
[\code]
I'm using this code to open up "object.dat"...then i want to read in the firstline of this file...im going to count backwards through the characters...and stick the first set in one variable (temp), then set the int tall=atoi(temp)...the object.dat is going to look like:
"400 200"
and i have to read both of those memories into 2 int variables...Can anyone add a proper fgets line to my above code to make it read the line in properly..i couldnt get it to work...i also need to stick a null pointer wherever the space occurs..can anyone help real fast? Thanks.