질문이 있습니다!~
당나귀
번거로우시겠지만 이소스를 공부해야대서요 ㅠㅠ 알기쉽게 주석좀 부탁드립니다#include stdio.h
#include ctype.h
#include stdlib.h
#include string.h
FILE *inFP,*outFP, *outFP2;
main (int argc, char *argv[])
{
char first_name[50];
char last_name[50];
char prim_city[50];
char county[50];
char mail_zip[50];
char phone[50];
char prev_key[50];
char key[50];
int line_no = 0;
int numLeaf;
long cLoc;
if (argc != 4) {
printf(Error\n);
exit(1);
}
numLeaf = (int) atoi(argv[3]);
strcpy(prev_key,-1);
inFP = fopen(argv[1], r);
outFP = fopen(argv[2],w);
outFP2 = fopen(tmp.dat,w);
while (line_no numLeaf) {
cLoc = ftell(inFP);
if (cLoc != (int) cLoc) {
printf(Error\n);
exit(10);
}
fscanf(inFP,%s %s %s %s %s %s ,first_name , last_name, prim_city, county, mail_zip, phone);
fprintf(outFP2,%s %s %s %s %s %s\n ,first_name , last_name, prim_city, county, mail_zip, phone);
strcpy(key,last_name);
if( strcmp(key,prev_key) ){
fprintf(outFP, %s %ld\n,key,cLoc);
strcpy(prev_key,key);
}
line_no++;
if (line_no % 1000 == 0)
fprintf(stdout, processed %d lines\n, line_no);
}
fprintf(stdout, procesed %d lines\n, line_no);
fclose(inFP);
fclose(outFP);
fclose(outFP2);
}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2694069 | unsigned 질문입니다. | 힘차 | 2025-05-07 |
2694012 | 전공 비전공자 개발자 (10) | 말글 | 2025-05-07 |
2693984 | 오버로딩이 무엇인가요? (2) | 헛매질 | 2025-05-07 |
2693956 | PlaySound재생이 안됩니다!(C에 음악넣기) | 지존 | 2025-05-06 |
2693928 | &와 *의 사용에 관한 명확한 이해 | 제나 | 2025-05-06 |
2693903 | 반복문 설명좀요 ㅠㅠ (2) | 란새 | 2025-05-06 |
2693869 | stdio.h 는 왜 쓰는건가요? (1) | 큰꽃들 | 2025-05-06 |
2693842 | 포인터 변수의 주소값끼리 더하는 것에 대해서 질문드립니다. (1) | 진솔 | 2025-05-05 |
2693811 | 소수 출력;;;; | 화이트캣 | 2025-05-05 |
2693788 | 이런 함수는 없나요? (3) | 앤드류 | 2025-05-05 |
2693758 | txt파일 불러와서 행렬로 저장 | 큰애 | 2025-05-05 |
2693727 | scanf 오류 문제!! (2) | 큰나래 | 2025-05-04 |
2693704 | 구조체 주소록 문제인데 도와주세요 (2) | 도1도캣 | 2025-05-04 |
2693676 | 열혈강의 c언어 질문입니다 | 하양이 | 2025-05-04 |
2693647 | 12.620000 을요 12.620 으로 어떻게 표현해요? (2) | 파도 | 2025-05-04 |
2693619 | 타이틀 코드.. | 단순드립 | 2025-05-03 |
2693591 | 컴파일 에러에서 질문드립니다 (3) | 게자리 | 2025-05-03 |
2693463 | 동적할당 이용시 fwrite사용을 어떻게 해야하나요..? (10) | 일본어못해요 | 2025-05-02 |
2693387 | 배열문제입니다 수정오류캡쳐했습니다 (6) | 연하얀 | 2025-05-01 |
2693356 | text 입출력 내림차순 질문입니다 ㅠ | 빛글 | 2025-05-01 |