Getting Data from Files

Hello,
I'm working on a project that reads a .txt file containing
-Employees' ID
-Employees' Last Name
-Employees' First Name
-Employees' Hourly Wage

This is how my text file looks:
2745|Brown|Jane|8.50
1121|Smith|Brian|12.75
8343|Jones|Nora|15.00
4231|White|Allan|9.00
5566|Moss|Peter|13.45
2002|Clark|Mary|10.00
9223|Edwards|Kim|13.00
2341|Young|Ann|13.00
5342|Peters|Peter|15.00


How would I make a function that takes this text file and fills an array
of Employee Structs (containing ID,LastName,FirstName,hourlyWage)?

The only thing I'm not really sure how to do is how to read each individual part and stopping at the "|". Could someone explain please?


BTW this is my Employee Struct
struct Employee
{
int employeeNumber;
string lastName;
string firstName;
TimeStamp timeWorked;
float hourlyWage;
float pay;
};
and I need to fill the Number, Last, First and HourlyWage only.
Employee theEmployees[MAX_EMPLOYEE_LIST]; //MAX_EMPLOYEE_LIST is 100.


see http://www.cplusplus.com/reference/string/getline/
You will then have to use stringstream to convert strings to numbers
aaah delimiter. -__- I feel dumb now lol, anyways thanks
Topic archived. No new replies allowed.