title: can't read file c++
body: <p>There is a file in directory and i'm trying to read a file but i can't. What is wrong with my code. Example is taken from <a href="http://www.cplusplus.com/forum/beginner/37208/" rel="nofollow">http://www.cplusplus.com/forum/beginner/37208/</a></p>
  
  <pre><code>    #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  #define MAX_LEN 100
  using namespace std;
  string inlasning ()
  {
    string text;
    string temp; // Added this line
  
    ifstream file;
    file.open ("D:\education\Third course\semestr 2\security\lab1.2\secret_msg.txt");
  
    while (!file.eof())
    {
      getline (file, temp);
      text.append (temp); // Added this line
    }
  
  
    cout &lt;&lt; "THE FILE, FOR TESTING:\n" // For testing
         &lt;&lt; text &lt;&lt; "\n";
  
    file.close();
  
    return text;
  }
  void main ()
  {
  inlasning();
  }
  </code></pre>