source.cinput.txtCode:#include <stdio.h> #define ARRAY_SIZE 20 int main() { FILE * pointer; int test1[ARRAY_SIZE], test2[ARRAY_SIZE]; int c, count; pointer = fopen("input.txt", "r"); if(pointer == NULL) { printf("Open operation failed."); return 1; } fscanf(pointer, "%d", &count); for(c = 0; c < count; c++) { fscanf(pointer, "%d%d", &test1[c], &test2[c]); } fclose(pointer);Am I inputting the file into my two arrays correctly? Only asking because I am away from home and can only use public computers.Code:7 78 88 79 67 80 90 81 56 82 76 83 99 70 82
Thanks in advance,
~Alan
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!



LinkBack URL
About LinkBacks



