×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: bilal baig
Added: Jan 7, 2018 7:03 AM
Views: 2677
Tags: no tags
  1. bool readFile(string &str)
  2. {
  3.         ifstream readData;
  4.         readData.open("test.dat", ios::in);
  5.         if (!readData)
  6.         {
  7.                 return 0;
  8.         }
  9.         else
  10.         {
  11.                 string input;
  12.                 while (!readData.eof())
  13.                 {
  14.                         getline(readData, input);
  15.                         str += input;
  16.                 }
  17.                 readData.clear();
  18.                 readData.seekg(0);
  19.                 readData.close();
  20.                 return 1;
  21.         }
  22. }