Question: use c++ Write a function getLinesFromFile that reads from a file and stores its content in an array. The function takes three parameters: a string

use c++
Write a function getLinesFromFile that reads from a file and stores its content in an array. The function takes three parameters: a string fileName, a string array wordArray, an integer sizeArray. getLinesFromFile should open the file in read mode, read each line, store each line in the array. The function should return the number of lines placed into the array. If the file does not exist, return -1. Example: if fileName.txt has the following contents: sky night 78 ski seasorn The function call getLinesFromFile("fileName. txt", wordArray, 4) would return 4 and wordArray would look like ['sky", "night", "78", "ski season"] Answer: (penalty regime: 0%)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
