A Fox Called Kay (kayfox) wrote,
A Fox Called Kay
kayfox

I got the Zebra label printer working!

This:

#include <stdio.h>

int main( void );
void printmessage( int, int, char[64], int, int );


int main( void )
{
printmessage( 10, 40, "Loial rules!", 60, 48 );
printf( "End...\n" );
getchar();
return( 0 );
}

void printmessage( int offsetx, int offsety, char message[64], int sizex, int sizey )
{
FILE *lptr;
lptr = fopen( "LPT1", "w" );
if ( lptr == 0 ) printf("Cant open LPT1.\n" );
fprintf( lptr, "^XA\n" );
fprintf( lptr, "^FO%i,%i^A0N,%i,%i^FD%s^FS\n", offsetx, offsety, sizex, sizey, message );
fprintf( lptr, "^PQ1\n");
fprintf( lptr, "^XZ" );
fclose( lptr );
}

Makes this:



Then, this:

#include <stdio.h>

int main( void );

int main( void )
{

FILE *lptr;
lptr = fopen( "LPT1", "w" );
if ( lptr == 0 ) printf("Cant open LPT1.\n" );

for( int it=0; it<21; it++ )
{

char message[64];
sprintf( message, "Box %3i", it );
fprintf( lptr, "^XA\n" );
fprintf( lptr, "^FO%i,%i^A0N,%i,%i^FD%s^FS\n", 10, 40, 60, 48, message );
fprintf( lptr, "^FO%i,%i^BY2\n", 10, 120 );
fprintf( lptr, "^B3N,N,%i,Y,N\n", 80 );
fprintf( lptr, "^FDBOX%03i\n", it );
fprintf( lptr, "^PQ1\n");
fprintf( lptr, "^XZ" );


}
fclose( lptr );

printf( "End...\n" );
getchar();
return( 0 );
}

Makes this:
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment