So I need help reading this text file into a Node. I want to put the title of the show as a string, the years as two different integers, a genre as a string, and the actors in a string array. I just have trouble placing the specific text into the proper places. I've tried using getchar or getline but I haven't come to any success. I'm not asking for an entire thing of code but just a point in the right direction would definitely help.
Because i don't know what you have so far,
i think that this code can help to you to
get all string lines from your file;
Jake and the Fatman (1987-1992)
Drama
[some link] <-Edited
William Conrad
Joe Penny
Alan Campbell
Kung Fu: The Legend Continues (1993-1997)
Adventure
[some link] <-Edited
David Carradine
Chris Potter
Richard Anderson
Kim Chan
Matlock (1986-1995)
Mystery
[some link] <-Edited
Andy Griffith
Nancy Stafford
Julie Sommars
Clarence Gilyard Jr.
Kene Holliday
The file you linked is not accessible, probably the server is too busy.
The browser shows: The connection has timed out
So I don't know how the input file looks like. Can you just copy and paste a few lines here?
I would create a struct to hold the data and overload << and >> to input and output it easily.
Are there any restrictions of library functions you can use?
constint MAX_ACTORS = 5;
struct Show
{
string title;
string genre;
string actors[MAX_ACTORS]; // better to use a vector if allowed
int year1, // find a meaningful name depending on the meaning
year2;
};
ostream& operator<<(ostream& os, const Show& show)
{
// place your code here
return os;
}
istream& operator>>(istream& is, Show& show)
{
// place your code here
return is;
}