2) Change the readLine function to:
- Code: Select all
int readLines(char *fileName, int max)
{
int i = 0;
FILE *fp = fopen(fileName, "r");
if(fp)
{
while(fgets(myArray[i], 256, fp)) //fgets used to get the whole line
{
i++;
}
fclose(fp);
}
//Number of read lines
return i;
}
3) Change the action code to:
- Code: Select all
int total;
total = readLines("file.txt", 100);
strcpy(debug1.text, myArray[0]);
debug2.textNumber = total;