function  writedword( val )
{
     val1 = val / 16777216 ;
     val  = val%16777216 ;
     val2 = val / 65536 ;
     val  = val%65536 ;
     val3 = val / 256 ;
     val4 = val%256 ;

     printf( "%c%c%c%c", val4, val3, val2, val1 ) > "genres.dat" ;
}
BEGIN {

     txtsize = 0 ;

     while ( getline <"xboxgenres.txt" )
     {
        if ( length($2) > txtsize )
           txtsize = length($2) ;
     }

     txtsize++ ;

     close( "xboxgenres.txt" ) ;

     writedword( 2 ) ;
     writedword( 4 ) ;
     writedword( txtsize ) ;


     while ( getline <"xboxgenres.txt" )
     {
         writedword( $1 ) ;
         printf( "%s", $2 ) > "genres.dat" ;
         for ( i = length($2) ; i < txtsize ; i++ )
         {
            printf( "%c", 0 ) > "genres.dat" ;
         }
     }

     close( "genres.dat" ) ;
}
{

}
