So I need some code that would fetch a line from a text document and turn it into a string.
e.g:
This is my text document called 'names.txt': Line 1. Bob, Line 2. Fred, Line 3. Bill, Line 4. Jack,
I want to fetch line 3 alone, and assign it to a string 'name'. So string name = Bill.
Another example:
My text document name is 'food.txt': Line 1. Banana, Line 2. Apple, Line 3. Cherry, Line 4. Strawberry,
I want to fetch line 2 and assign it to a string 'fruit'. So string fruit = Apple.
C++ On Windows btw.
(Im not very good with formatting on this site, sorry :p)
Aucun commentaire:
Enregistrer un commentaire