title: Read and Write Binary files-FORTRAN and C++
body: <p>I am writing binary file with the following code in FORTRAN:</p>
  
  <pre><code>Character(50) S
  Real*8 A
  A = 25.002  
  OPEN(1,file='data.bin', access='stream',action='write') 
  WRITE (1) A        
  CLOSE(1)
  </code></pre>
  
  <p>And trying to read that with the following code in C++:</p>
  
  <pre><code>ifstream::pos_type size;
  char * memblock
  
  ifstream file ("data.bin", ios::in|ios::binary|ios::ate);
  if (file.is_open())
  {
    size = file.tellg();
    memblock = new char [size];
    file.seekg (0, ios::beg);
    file.read (memblock, size);
    file.close();
  
    delete[] memblock;
  }
  </code></pre>
  
  <p>But it does not work! The second code can not read the file created by the first code. 
  Any help appreciated! </p>