[ create a new paste ] login | about

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

C, pasted on Dec 19:
#include<stdio.h>
#include<conio.h>

void transFile(FILE* inFile, FILE* outFile)
{
	int ch;
	while(1)
	{
		ch = fgetc(inFile);
		if(!feof(inFile))
		{
			fputc(ch, outFile);
		}
		else 
			break;
	}
}
void main()
{
	FILE* fpIn, *fpOut;
	char* fname = "Data.txt"; char* fcopy = "DataCopy.txt";
	fpIn = fopen(fname, "rt");
	if(fpIn == NULL)
	{
		printf("File %s not found!\n", fname);
		return;
	}
	fpOut = fopen(fcopy, "wt");
	if(fpOut == NULL)
	{
		printf("Can not open file %s!\n", fcopy);
		fclose(fpIn);
		return;
	}
	transFile(fpIn, fpOut);
	fclose(fpIn);
	fclose(fpOut);

	getch();

}


Output:
1
2
3
Line 17: error: conio.h: No such file or directory
In function 'main':
Line 19: warning: return type of 'main' is not 'int'


Create a new paste based on this one


Comments: