File:  [MW Coherent from dump] / coherent / d / usr / src / examples / getc.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:38 2019 UTC (7 years, 2 months ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

#include <stdio.h>

void error();

main(argc, argv)
int argc; char *argv[];
{
	int foo;
	FILE *source, *dest;

	if (argc != 3)
		error("Usage: getc source destination");

	if ((source = fopen(argv[1], "r")) == NULL)
		error("Cannot open source file");
	if ((dest = fopen(argv[2], "w")) == NULL)
		error("Cannot open destination file");

	while ((foo = getc(source)) != EOF)
		putc(foo, dest);
	exit(0);
}

void error(string)
char *string;
{
	printf("%s\n", string);
	exit (1);
}


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.