I am working on a project for school and I can't get my readFile function to work. There is something wrong for the arrays that I am putting in.
Here is the text file I am trying to read from:

4
Assign1 200 10
Assign2 100 80
Project 100 45
Midterm 100 30

Here is my code so far:

int readFile(char fileName[])
{
  int i = 0;
  ifstream input;

  int name[10];
  int points[10];
  int percent[10];


  input.open(fileName);

  while (!input.eof())
    {
      input.getline(

      i++;
    }
  input.close();

  cout << name[3];
}

It reads the files but it doesn't save it to the array. How would I do this? Also how would I skip the first line in the txt file so I don't read it. Can ou please help? Thank you.

Based on the code, it doesn't compile. Either explain the real problem or post the correct code.

You can't 'skip' a line. Just read it and ignore what you read.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.