apple2_hgr_font_tutorial/c_2_fontbin.c
2016-01-10 10:06:04 -08:00

22 lines
514 B
C

#include <stdio.h>
#include "font.h"
int main()
{
const size_t len = sizeof( FONT) / sizeof( char );
const size_t MAX = 8192;
char buf[ MAX ]; // Assume font data is < 8K
if (len > MAX)
return printf( "ERROR: Font data to large: %u > %u\n", (unsigned) len, (unsigned) MAX );
FILE *pFile = fopen( "font.bin", "wb" );
if( pFile )
{
for( size_t i = 0; i < len; ++i )
fwrite( &FONT[ i ], 1, 1, pFile );
fclose( pFile );
}
return 0;
}