fopen - Inputting a file to fill an array.
#define ARRAY_SIZE 20
FILE * pointer;
int test1[ARRAY_SIZE], test2[ARRAY_SIZE];
int c, count;
pointer = fopen("input.txt", "r");
if(pointer == NULL)
printf("Open operation failed.");
fscanf(pointer, "%d", &count);
for(c = 0; c < count; c++)
fscanf(pointer, "%d%d", &test1[c], &test2[c]);
Am I inputting the file into my two arrays correctly? Only asking because I am away from home and can only use public computers.
Thanks in advance,
PS: Anyone know of a portable IDE compatible with MS C++? I was using CodeBlocks, but the source file would not compile correctly with MS C++, which is what my profs use to check for compile errors. Thanks again!