int readLines(char *fileName, int max, long *array)
{
int i = 0;
FILE *fp = fopen(fileName, "r");
if(fp)
{
while(fscanf(fp, "%d", &array[i]) > 0)
{
i++;
}
fclose(fp);
}
//Number of read lines
return i;
}
readLines("file.txt", 100, myArray);
Users browsing this forum: No registered users and 1 guest