1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
 
  | 
#include <fstream>
using namespace std;
main () {
   int a = 1024;
   int b = 768;
   int c = 24;
   ofstream ofs ("x.tga", ios::binary);
         ofs.put (0), ofs.put (0), ofs.put (2), ofs.put (0), ofs.put (0), ofs.put (0);
         ofs.put (0), ofs.put (0), ofs.put (0), ofs.put (0), ofs.put (0), ofs.put (0);
         ofs.put (a), ofs.put (a >> 8), ofs.put (b), ofs.put (b >> 8);
         ofs.put (c),   ofs.put (0);   
   for (int i=0; i<a; i++)
      for (int j=0; j<b; j++)
         ofs.put (1),          ofs.put (0),          ofs.put (0);         
   ofs.close ();
  |  |