Chapter - 13: File Input-Output

Write a program to copy one file to another. While doing so replace all lowercase characters to their equivalent uppercase characters.


File (d)1.txt


It is a remarkable dichotomy. In many ways, Clark is the most human of us all. Then... he shoots fire from the skies and it is difficult not to think of him as a god. And how fortunate we all are that it does not occur to him.
-- Batman

#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
	char str[50];
	FILE *f1, *f2;
	f1 = fopen("File (d)1.txt", "r");
	f2 = fopen("File (d)2.txt", "w");
	while (fgets(str, 49, f1) != NULL)
	{
		_strupr(str);
		fputs(str, f2);
	}
	_getch();
	return 0;
}

© 2021 Garbage Valuegarbage value logo