-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck_upper_lower.c
More file actions
48 lines (41 loc) · 885 Bytes
/
check_upper_lower.c
File metadata and controls
48 lines (41 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//Header
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
//Main
int main(int argc,char *argv[]){
//Check For Argumnents
if(argc ==3){
printf("\nWorking ......\n");
FILE *fp_ori,*fp_new;
fp_ori=fopen(argv[1],"r");
fp_new=fopen(argv[2],"w");
//Check File Existance
if(fp_new !=NULL & fp_ori!=NULL){
//Variables
char data,tar_data;
int return_value;
//File Reading
//N no of input
//Checking for Data in File
while((data=fgetc(fp_ori))!=EOF){
if(isupper(data)){
tar_data=tolower(data);
}else{
tar_data=toupper(data);
}
//File Writing
fputc(tar_data,fp_new);
}
//Closing the File
fclose(fp_ori);
fclose(fp_new);
printf("\nDone\n");
}else{
printf("\nFile Does\'nt Exist\n");
}
}else{
printf("\nINVALID NO. OF ARGUMENTS\n");
}
return 0;
}