Skip to content

Instantly share code, notes, and snippets.

@opklnm102
Created October 1, 2014 08:12
Show Gist options
  • Save opklnm102/3ff7788fd7ca08d8f2d9 to your computer and use it in GitHub Desktop.
Save opklnm102/3ff7788fd7ca08d8f2d9 to your computer and use it in GitHub Desktop.
software global project
#include<stdio.h>
int main(int argc, char *argv[])
{
FILE *fp1,*fp2;
char ch;
fp1 = fopen("filecopy.cpp","r");
if(fp1 == NULL){
printf("Error: %s does not exist!\n","filecopy.cpp");
return -1;
}
fp2 = fopen("result.cpp","w");
if(fp2 == NULL){
printf("Error: %s file can not open!\n","result.cpp");
return -2;
}
while((ch = fgetc(fp1)) != EOF){
fputc(ch,fp2);
}
fclose(fp2);
fp2=fopen("result.cpp","r");
if(fp2 == NULL){
printf("Error: %s file does not exist!\n","result.cpp");
return -3;
}
while((ch = fgetc(fp2)) != EOF){
putc(ch,stdout);
}
}
//입력 파일 filecopy.cpp를 character 단위로 읽어 출력 파일 result.cpp 에 복사하고,
//복사가 끝나면 다시 result.cpp을 열어 character 단위로 읽어 화면에 출력하는 프로그램을 작성합니다.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment