Read SPECIFIC line from text file
hi, i have JUST started cpp and im working on something. i want my prog to read a specific line from a text file and then store that to an array. for example:
Code:
#include <fstream.h>
#include <iostream.h>
int main();
{
char username1[20];
char username2[20];
char username3[20];
char username4[20];
ofstream savefile ("users.txt");
ifstream OpenFile("users.txt");
//this is what i dont know what to do, i want it to read each line
//of users.txt and store each line to its own variable
//i.e store line 1 of users.txt to username1 and so on.
any help is apprieciated :D