[ create a new paste ] login | about

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

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

void convertFile(FILE* inFile, FILE* outFile)
{
	int ch;
	while(1)
	{
		ch = fgetc(inFile);
		if(!feof(inFile))
		{
			ch = toupper(ch);
			fputc(ch, outFile);
		}
		else
			break;
	}
}
void main()
{
	FILE* fpIn, *fpOut;
	char* fname = "Data.txt"; char* fcopy = "DataUpper.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;
	}
	convertFile(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 21: warning: return type of 'main' is not 'int'


Create a new paste based on this one


Comments: