+ 2

How to use getline function with 3 parameters?

Firstly I read a file and stored it into char array. Now I want to create a string array from char array with the help of getline function.

27th Sep 2018, 8:36 PM
Sana Fatima
1 Answer
+ 1
You won't be doing it with getline as it doesn't allow specifying a buffer to process. I'd make a list of pointers to the start of each line and replace the '\n' with the '\0' needed to end a C string as you are reading in the file. One of the constructors for the string class accepts C strings so you could convert the easily.
1st Oct 2018, 6:57 PM
John Wells
John Wells - avatar