I'm working my first program that includes structures. For some reason though I have having errors with my getline.

inFile.getline( studentar, 20 );

My getline is being used in a function, so I don't know if that effects anything. The studentar array is declared as type student because that is what the structure I created is. Any suggestions would be great.

Read the prototype of getline
The first argument should be a char array ( a cstring).
Tell us what is the structure of student.

This is my structure.

struct student
int studentID;
double programAvg;
double testAvg;

Well there's your problem, read a tutorial on structures and data types
and you'll find out what you've done wrong. [Link]

Who told you to use cin.getline, didn't you knew cin.getline is only to fetch cstrings?

You should have used simple cin>> statement to read the data.

My teacher told me to use the getline function.

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.