[초보 프로 그래 밍 훈련 종목]001-C 언어 텍스트 통합 01

1825 단어 C 언어 연습
날짜:2017 년 8 월 25 일
첫 번 째 항목:
작업 목표:두 텍스트 파일 의 내용 을 새 텍스트 에 통합 합 니 다(fgetc 와 fputc 함수 사용)
프로 그래 밍 환경:Windows 10 Enterprise,Visual Studio 2017 Enterprise
#pragma warning(disable:4996) //VS     ?

#include 
#include 
#include 

void main(void)
{
	printf("Program initiating...
"); /*################### 1 2, "Output_file.txt" ###################*/ FILE *fpa, *fpb, *fpc; char file_name_1[200], file_name_2[200]; // printf(" 1 :"); scanf("%s", file_name_1); printf("Openning %s
", file_name_1); // if ((fpa = fopen(file_name_1, "r")) == NULL) // fpa { printf("Open failure...
"); // , " " exit(0); // } printf("
2 :"); scanf("%s", file_name_2); printf("Openning %s
", file_name_2); // if ((fpb = fopen(file_name_2, "r")) == NULL) // fpb { printf("Open failure...
"); // , " " exit(0); // } if ((fpc = fopen("Output_file.txt", "w")) == NULL) // fpc { printf("Open failure...
"); // , " " exit(0); // } printf("Building Output_file.txt
"); // /*################### 1 2 Output_file ###################*/ char cha,chb; while ((cha = fgetc(fpa)) != EOF) { fputc(cha, fpc); } while ((chb = fgetc(fpb)) != EOF) { fputc(chb, fpc); } /*################### Output_file 1、2 ###################*/ fclose(fpc); fclose(fpb); fclose(fpa); system("pause"); }

좋은 웹페이지 즐겨찾기