DataMuseum.dk

Presents historical artifacts from the history of:

Commodore CBM-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Commodore CBM-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦75342471d⟧ TextFile

    Length: 587 (0x24b)
    Types: TextFile
    Notes: UNIX file
    Names: »file.c«

Derivation

└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
    └─⟦2d53db1df⟧ UNIX V7 Filesystem
        └─ ⟦this⟧ »frankh/src/junk/file.c« 

TextFile

/*
 *  Convert interger to ascii string ( leading zeros )
 *  five places.
 */
char *itoa(in, strng)
unsigned int in;
char *strng;
{
register int i;
unsigned int p;
	p = 10000;
	strng[0] = 32; 		/* lead off with a blank	*/
	for(i = 1; i != 6; ++i) {
		strng[i] = in / p + 0x30;
		in = in - ( in / p ) * p;
		p = p / 10;
	}
	return(strng);
}

/*
 * write a character string to a file.
 *  string terminated with '\000'.
 */
stwrite(fd, strng)
FILE *fd;
char *strng;
{
register int i;

	for (i = 0; strng[i] != 0; ++i)
		if (putc(strng[i], fd) == EOF)
			printf("stwrite: bad write\n");
}