Created
March 18, 2013 23:40
-
-
Save mertyildiran/5192051 to your computer and use it in GitHub Desktop.
Alıştırma 2.b’ de hazırlamış olduğunuz C programına benzer şekilde, kaynak dosyadaki tüm küçük karakterleri büyüğe çevirerek hedef dosyaya kopyalama işlemini yapabilecek bir C programı hazırlayınız. Programınızda “islower”, “isupper”, “tolower” ve “toupper” fonksiyonlarını kullanmadan, karakterlerin ASCII değerlerinin hangi tamsayılara karşılık …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
char ch, source_file[20], target_file[20]; | |
FILE *source, *target; | |
printf("Enter name of file to copy\n"); | |
gets(source_file); | |
source = fopen(source_file, "r"); | |
if( source == NULL ) | |
{ | |
printf("Press any key to exit...\n"); | |
exit(EXIT_FAILURE); | |
} | |
printf("Enter name of target file\n"); | |
gets(target_file); | |
target = fopen(target_file, "w"); | |
if( target == NULL ) | |
{ | |
fclose(source); | |
printf("Press any key to exit...\n"); | |
exit(EXIT_FAILURE); | |
} | |
while( ( ch = fgetc(source) ) != EOF ) | |
ch=toupper(ch); | |
fputc(ch, target); | |
printf("File copied successfully.\n"); | |
fclose(source); | |
fclose(target); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment