[ create a new paste ] login | about

Link: http://codepad.org/INZ95U91    [ raw code | output | fork ]

nel - C, pasted on Apr 25:
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
	FILE *from;
	FILE *to;
	int CopyChar;

	if(argc>=4) {
		printf("Too few arguments.");
		exit(1);
	}
	
	if((from = fopen(argv[1], "r"))==NULL) {
		printf("File %s not found.", argv[1]);
	}

	else 
	{
		to = fopen(argv[2], "wb");
        
		printf("Copying data from %s to %s...\nDone!", argv[1], argv[2]);

		while((CopyChar = fgetc(from))!=EOF) {
			fputc(CopyChar, to);
		}
	   fclose(from);
	   fclose(to);
	}

	getch();

	return 0;
}


Output:
1
2
In function `main':
undefined reference to `getch'


Create a new paste based on this one


Comments: