25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more...
Home   Projects   Up   Sitemap   Search   Blog   Forum+Chat   About Us   Privacy   Terms of Use   Feedback   FAQ   Images   Services   Payments   Humor   Music

Adjust the dimensions of a graphic .PIC file

This was a trivial program written to fix a .PIC file when I accidentally created one with the wrong dimensions. 

DeSmet C. Heathkit H-100 computer.

/*	adjust.c   11/19/93
	Copyright (C)1993 Steven Whitney. Published under the 
	GNU GPL (General Public License) Version 3, with ABSOLUTELY NO WARRANTY.
	Initially published by http://25yearsofprogramming.com. 

	adjusts (crops) the dimensions of a .PIC file. 
	I used it when the H89 MBROT program created a file with too many pixels on a row, or too many rows.
	You'll probably need to customize it for each use. 

*/
#include "stdio.h"

main()
{
FILE *infile, *outfile;
int i;
char buf[641];	/* Size this to hold one line from the source file */	

infile = fopen("h891-100.pic","r");
outfile = fopen("outfile.pic","w");

for(i = 0 ; i < 225 ; i++)	/* Only process the first 225 lines, for the H100 */
{								
	fread(buf,1,641,infile);	/* read a line of the size H89 created */	
	fwrite(buf,1,640,outfile);	/* just omit the extra chars when writing */
}
closeall();
}

 

 

Valid HTML 4.01 Transitional Valid CSS
Yahoo! Search
Search the web Search this site
View content labeling at ICRA.