반응형 2016/08/252 2016-08-25_조재찬_스터디일지_C언어-파일 입출력 입력 스트림과 출력 스트림의 형성을 요청하는 fopen 함수 #include FILE * fopen(const char * filename, const char * mode); fopen함수를 통해 FILE 구조체 변수가 생성, 파일과의 스트림 형성 FILE 구조체 변수에 파일 정보가 담김 (파일 데이터가 담기는 것이 아님) FILE * fp = fopen("data.txt", "wt"); // wt(write in text mode)모드로 파일 data.txt와 출력스트림을 형성FILE * fp = fopen("C:\\Project\\data.txt", "wt"); // 경로 지정시 \ 자체를 표현하려면 \\ 두개 써야함 FILE * fp = fopen("data.txt", "rt"); // rt모드는.. 2016. 8. 25. 2016-08-24_조재찬_스터디일지_C언어-구조체 /*중첩된 구조체의 정의Point 구조체(x, y pos), Circle 구조체(Point cen, double rad)center, radius를 보여주는 함수를 정의하고 메인함수에서 출력*/ 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 #include typedef struct { int xpos; int ypos; }Point; typedef struct { Point cen; double rad; }Circle; Circle GetCircleInfo(void) { Circle cir; printf("원의 중심 입력: "); scanf("%d %d", &cir.cen.xpos, &cir.cen... 2016. 8. 25. 이전 1 다음 728x90 반응형