title: How to read and write data in 8 bit integers unit form by c++ file functions
body: <p>Is it possible to store data in integer form from 0 to 255 rather than 8-bit characters.Although both are same thing, how can we do it, for example, with write() function?
  Is it ok to directly cast any integer to char and vice versa? Does something like</p>
  
  <pre><code>{
      int a[1]=213; 
      write((char*)a,1);
  } 
  </code></pre>
  
  <p>and </p>
  
  <pre><code>{
      int a[1]; 
      read((char*)a,1); 
      cout&lt;&lt;a;
  }
  </code></pre>
  
  <p>work to get 213 from the same location in the file? It may work on that computer but is it portable, in other words, is it suitable for cross-platform projects in that way? If I create a file format for each game level(which will store objects' coordinates in the current level's file) using this principle, will it work on other computers/systems/platforms in order to have loaded same level?</p>