Write a CC function to write entries to a file according to

Write a C/C++ function to write entries to a file according to void arr_process (in_array, N, start_index, stop_index, outFilename)

Solution

   ofstream fout(\"test.txt\"); //opening an output stream
   /*checking whether file could be opened or not. If file does not exist or don\'t have write permissions, file
stream could not be opened.*/
if(fout.is_open())
   {
//file opened successfully so we are here
cout << \"File Opened successfully!!!. Writing data from array to file\" << endl;

       for(int i = 0; array[i] != \'\\0\'; i++)
       {
fout << array[i]; //writing ith character of array in the file
       }
cout << \"Array data successfully saved into the file test.txt\" << endl;
   }
   else //file could not be opened
  {
       cout << \"File could not be opened.\" << endl;
   }
   return 0;
}

 Write a C/C++ function to write entries to a file according to void arr_process (in_array, N, start_index, stop_index, outFilename) Solution ofstream fout(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site