Hello Nichismoke,
Welcome to the forum.
I can not duplicate your error at this time because the program will not compile for me.
Some problems I have noted:
"data.txt" I do not have the information that you are using. I could create this file, but there is no guarantee that what I crate will be correct. When you post a program that reada a data file it is best to include the file or at least a sample of the file so people do not have to guess at what is in the file.
1 2
|
Student * studentRecords;
studentRecords = new Student[0];
|
Line 1 is OK.
Line 2. is likely creating a "nullptr" or it is creating a pointer to nothing because there is no size to the lock of memory that being created. what is between the [] needs to have a size like 5 or 10 or even a variable for the size. Also "new" returns a void pointer, so you may want to typecast the return value to what you need.
You might want to read this:
http://www.cplusplus.com/reference/new/operator%20new[]/
Through out your program you need to be consistent. Some of your for loops define "i" as being an "int", but in the middle you are comparing that "int" to an "unsigned int". This flags a warning, but not enough to be a problem.
Some of your code looks like this:
else if (command == "clear") {
, but in other places you use:
1 2
|
else if (command == "clear")
{
|
This second example makes the code easier to read when the {} line up in the same column. Just saying because either way works. It is better to be consistent with either way.
Your line 42 may work, but i have seen this more often written as
if (!inFile)
or
if (!inFile.open()
. Either way it is less restrictive as to what went wrong.
Line 108 does not work. First "studentRecords" has no storage space then you are trying to initialize an object of type "Student", but the point of using the "new" to create an array each element of the array would already be an object of type "Student" you would have to access each variable of the struct togive it a new value or create a function to do this.
Line 133 may be funny to you, but not everyone.
Last the error you first mentioned is not in your code, but in the header file "local". One of your original include statements has included the header file "local" and something in the program is using this function. Where I am not sure yet until I can get the program to compile run.
Just out of curiosity what version of VS are you using?
Hope that helps,
Andy