질문이 있습니다!~
당나귀
번거로우시겠지만 이소스를 공부해야대서요 ㅠㅠ 알기쉽게 주석좀 부탁드립니다#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);
}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2700426 | 인터넷 창 띄우는 질문이요 (1) | 정훈 | 2025-07-04 |
2700400 | 원넓이를 계산이요 ㅜㅜ | 천칭자리 | 2025-07-04 |
2700368 | if에 관해서 질문이요... | Orange | 2025-07-04 |
2700339 | 이거 결과값이 왜이런건지.. (4) | 그댸와나 | 2025-07-04 |
2700313 | 파일 읽어서 저장하는데 빈파일일 경우 문재가 발생하네요.. (2) | 크나 | 2025-07-03 |
2700287 | 구조체 동적할당 연습을 하는데 오류가 뜹니다...(해결) (3) | 아련나래 | 2025-07-03 |
2700264 | 문자와 숫자 동시에 입력??? | 글고운 | 2025-07-03 |
2700236 | txt파일로만 쓰고 읽게 하려면 어떻게 해야 하나요..?? (8) | 미국녀 | 2025-07-03 |
2700211 | 전위 연산자 (2) | 어른처럼 | 2025-07-02 |
2700183 | C에서 파일이름을 받고, 그 파일의 사이즈를 출력해줘야하는데 내용이 출력이 안되네요 ;ㅅ; | 피스케스 | 2025-07-02 |
2700150 | 꼭좀 도와주세요ㅠㅠㅠ | 호습다 | 2025-07-02 |
2700095 | 연산문제...질문... | 오빤테앵겨 | 2025-07-01 |
2700070 | while문 , 3의배수 출력하는 프로그램좀 짜주세욤. | 횃불 | 2025-07-01 |
2700041 | 초보인데요 ㅎ 배열안에 배열을 집어넣을수 있나요?? | 헛장사 | 2025-07-01 |
2700012 | 배열// (1) | 전갈자리 | 2025-07-01 |
2699895 | 무한루프에 빠집니다.!! 해결좀부탁드려요 (10) | 선아 | 2025-06-30 |
2699842 | 질문을 너무 많이 하네여.....죄송.... (2) | 해님꽃 | 2025-06-29 |
2699816 | 오류 질문입니다.. (1) | 해비치 | 2025-06-29 |
2699763 | 질문입니다 ! 꼭 좀 도와주세요ㅠㅠ (2) | 미라 | 2025-06-28 |
2699555 | c언어 다항식을 입력을 했는데 왜 출력이 안될까요? | 피스케스 | 2025-06-27 |