title: invalid conversion from 'std::string (*)(std::ofstream&, const string&, std::string, int
body: <p>I wrote a file reader/writer
  heres the code its still not finished.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  
  const std::string path_to_data = "\\data";
  const std::string level_file = path_to_data+"\\level_file.lev";
  
  
  
  typedef std::string (*f_read)(std::ifstream&amp; fin,const std::string&amp; level_file,int    line_num);
  typedef std::string (*f_write)(std::ofstream&amp; fout,const std::string&amp; level_file,   std::string&amp; what_to_write,int line_num);
  typedef std::string (*pt_f_manger)(f_read,f_write);
  
  
  
  inline bool is_empty(std::ifstream&amp; pFile){return pFile.peek() ==     std::ifstream::traits_type::eof();}
  std::string file_manger(f_read,f_write);
  std::string read_file(std::ifstream&amp; fin,const std::string&amp; level_file,int line_num);
  std::string write_file(std::ofstream&amp; fout,const std::string&amp; level_file,std::string what_to_write, int line_num);
  std::string error_handler(std::string error_type,pt_f_manger f_manger);
  
  
  int main()
  {
  std::string error = file_manger(read_file,write_file);
  std::cout&lt;&lt;error&lt;&lt;"\n";
  std::cin.get();
  std::cin.get();
  return 0;
  }
  
  std::string file_manger(f_read f_input,f_write f_output)
  {
  std::string good = "good";
  std::string error = "error";
  std::ifstream fin;
  std::ofstream fout;
  std::string test = "test";
  std::string output = f_output(fout,level_file,test,0);
  std::string input = f_input(fin,level_file,0);
  if (output != "good")
      return error;
  if (input != "good")
      return error;
  
  return good;
   }
  
   std::string write_file(std::ofstream&amp; fout,const std::string&amp; level_file, std::string&amp;  what_to_write,int line_num)
   {
  const char* level_filec = level_file.c_str();
  std::ifstream fin;
  fin.open(level_filec);
  if (fin.is_open())
      return "failed to open "+level_file;
  
  if (is_empty(fin))
  {
      fin.close();
      fout.open(level_filec);
      if (!fout.is_open())
          return "failed to open "+level_file;
  
      fout&lt;&lt;what_to_write;
      fout.close();
      return "good";
  }
  int i = 0;
  int num = 0;
  char ch;
  while (fin.good() &amp;&amp; i != line_num)
  {
      fin.get(ch);
      if (ch == '\n')
          ++num;
      ++i;
  }
  int pos = fin.tellg();
  fin.close();
  fout.open(level_filec,std::ios_base::in);
  if (!fout.is_open())
      return "failed to open "+level_file;
  fout.seekp(pos);
  fout&lt;&lt;what_to_write;
  fout.close();
  return "good";
    }
  
    std::string read_file(std::ifstream&amp; fin,const std::string&amp; level_file,int line_num)
    {
     const char* level_filec = level_file.c_str();
  std::string read;
  fin.open(level_filec);
  if (fin.is_open())
      return "failed to open "+level_file;
  
  if (is_empty(fin))
  {
      fin.close();
      return "file is empty";
  }
  int i = 0;
  int num = 0;
  char ch;
  while (fin.good() &amp;&amp; i != line_num)
  {
      fin.get(ch);
      if (ch == '\n')
          ++num;
      ++i;
  }
  std::getline(fin,read);
  return read;
      }
  
      std::string error_handler(std::string error_type,pt_f_manger f_manger)//work in progress
      {
  return "good";
      }
  </code></pre>
  
  <p>and i get this error</p>
  
  <p>C:\Users\john\Documents\main.cpp||In function 'int main()':|
  C:\Users\john\Documents\main.cpp|25|error: invalid conversion from 'std::string (*)  (std::ofstream&amp;, const string&amp;, std::string, int) {aka std::basic_string (*) (std::basic_ofstream&amp;, const std::basic_string&amp;, std::basic_string,  int)}' to 'f_write {aka std::basic_string (*)(std::basic_ofstream&amp;, const   std::basic_string&amp;, std::basic_string&amp;, int)}' [-fpermissive]|
  C:\Users\john\Documents\main.cpp|17|error:   initializing argument 2 of 'std::string  file_manger(f_read, f_write)' [-fpermissive]|
  ||=== Build finished: 2 errors, 0 warnings (0 minutes, 0 seconds) ===|</p>
  
  <p>im using code::blocks.</p>