1. Write a function that, given a file path/name as a string opens the file and returns its entire contents as a single string. Any endline characters should be preserved. char *getFileContents(const...


Can you give the answer to these two questions


1. Write a function that, given a file path/name as a string opens the file and returns<br>its entire contents as a single string. Any endline characters should be preserved.<br>char *getFileContents(const char *filePath);<br>2. Write a function that, given a file path/name as a string opens the file and returns<br>the contents of the file as an array of strings. Each element in the array should<br>correspond to a line in the file. Any end line character should be chomped out and<br>not included. The size of the resulting array of strings needs to be communicated<br>to the calling function using the pass-by-reference numLines parameter (it is not<br>input).<br>char **getFileLines(const char *filePath, int *numLines);<br>

Extracted text: 1. Write a function that, given a file path/name as a string opens the file and returns its entire contents as a single string. Any endline characters should be preserved. char *getFileContents(const char *filePath); 2. Write a function that, given a file path/name as a string opens the file and returns the contents of the file as an array of strings. Each element in the array should correspond to a line in the file. Any end line character should be chomped out and not included. The size of the resulting array of strings needs to be communicated to the calling function using the pass-by-reference numLines parameter (it is not input). char **getFileLines(const char *filePath, int *numLines);

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here