How to use getline function with 3 parameters? | Sololearn: Learn to code for FREE!

+1

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.

9/27/2018 8:36:37 PM

Sana Fatima

1 Answer

New 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.