Dec 152017
 
Source code print program for hp thinkjet.
File HPPRINT.ZIP from The Programmer’s Corner in
Category Printer Utilities
Source code print program for hp thinkjet.
File Name File Size Zip Size Zip Type
HPPRINT.C 3218 976 deflated
HPPRINT.DOC 3670 1377 deflated
HPPRINT.EXE 10020 5992 deflated

Download File HPPRINT.ZIP Here

Contents of the HPPRINT.DOC file


HPPRINT (c) 1987, GMUtant Software

HPPRINT.EXE is a short 'C' program to print out source code listings
on an HP-THINKJET printer. The program prints in compressed mode
with 80 lines per page. You should use the Alternate Mode on your
printer (for IBM-PC). With minor modifications, this can drive
most any dot-matrix printer...just find out what your codes for
compressed print and 8 lines per page are and modify.

Here's the source code for HPPRINT

/*
** Program: hpprint.c
** Function: file dump program for HP-THINKJET.
** Prints program in condensed mode, 8 lines to inch (80 lines page)
** Line Numbering optional.
** Date: 09/14/87
** Compiler: Microsoft, version 4.0
** Author: W. Grotophorst, Library Systems Office, George Mason U.
*/

#include
#include
#include
#include

#define MAX 225
#define BREAKPOINT 6
#define PutPrinter(ch) putc(ch,stdout)
#define PAGE 80

FILE *InFile;
main(argc,argv)
int argc;
char *argv[];
{
struct tm *newtime;
char *am_pm = "PM";
time_t long_time;

char line[MAX];
char fname[13]; /* holds name of file, print at top of each page */
int lines=0; /* line counter, per page */
int pc=1; /* page counter */
int i,lc=0;

time(&long_time);
newtime = localtime(&long_time);
if (newtime->tm_hour < 12) /* time routine from Microsoft */
am_pm = "AM"; /* C (version 4) reference */
if (newtime->tm_hour > 12) /* manual, page 262 */
newtime->tm_hour -= 12;

if (argc < 2) {
puts(" ");
puts("HPPRINT (c) 1987, GMUtant Software");
puts("Source Code print program for HP-Thinkjet printer (Alternate mode).");
puts("Program prints out source code listing in condensed print, 80 lines per page.");
puts("Line numbering is optional.");
puts(" ");
puts("Usage: HPPRINT FileName [l] [Output to Screen]");
puts(" HPPRINT FileName [l] > LPT1: [Redirect Output]");
puts(" [l] is optional, will add line numbers to source.");
exit(0);
}

strcpy(fname,argv[1]);

if (!(InFile = fopen(argv[1],"r"))) {
puts("hpprint [ERROR]: Can't find input file [%s]",argv[1]);
exit(0);
}

PutPrinter(15); /* HP THINKJET (Alt Mode) Compressed */
PutPrinter(27); /* 8 lines to */
PutPrinter(48); /* the inch */

printf("-------------------------------------------------------------------------------------------------------------\n");
printf("%s print date: %.16s %s \n",fname,asctime(newtime),am_pm);
printf("-------------------------------------------------------------------------------------------------------------\n");

while (fgets(line,MAX,InFile) != NULL)

{
lines++;
lc++;
if ( lines > PAGE )
{
for(i=1;i printf("\n");
pc++;
printf("%s (continued) page: %d\n\n",fname,pc);
lines = 0;
}
if (argc == 2)
printf(" %s",line);
else
{
printf("[%d] %s",lc,line);
}
}

fclose(InFile);

PutPrinter(18); /* Return Printer to Normal */
PutPrinter(27); /* 8 lines to */
PutPrinter(50); /* the inch */

} /* EOF: hpprint.c */


 December 15, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)