무슨 에러인지좀 봐주셔요
돌심장
질문 제목 : 질문 내용 :
1 #include stdlib.h
2 #include stdio.h
3 #include sys/types.h
4 #include dirent.h
5 #include sys/stat.h
6 #include string.h
7 #include unistd.h
8 #ifndef path_max
9 #defind path_max 255
10 #endif
11
12 void find_directory(dir *, char *, char *, char *);
13 int isdirectory(char *);
14*
15 main(int argc, char *argv[]) {
16
17 dir *dir;
18 char cwd[path_max];
19
20 if( (dir=opendir(argv[1])) == null )
21 perror(opendir error);
22 getcwd(cwd, path_max);
23 find_directory(dir, argv[1], argv[2], cwd);
24 closedir(dir);
25 }
26
27 void find_directory(dir *dir, char *path, char *string, char *ad) {
28
29 dir *imsi_dir;
30 struct dirent *directory;
31 struct stat file_stat;
32 char buff[1024];
33 char answer[32];
34 char mycwd[path_max];
35
36
37 while( directory = readdir(dir) ) {
38 if( !strrnncmp(directory-d_name, ., 1) )
39 continue;
40 if( directory-d_ino == 0 )
41 continue;
42 sprintf(buff, %s/%s, path, directory-d_name);
43
44
45 if( strstr(directory-d_name, string) ) {
46 chdir(path);
47 if( getcwd(mycwd, path_max) == null )
48 perror(failed to get current working directory);
49 printf(%s/%s\n, mycwd, directory-d_name);
50 chdir(ad);
51 }
52
53 if( isdirectory(buff) ) {
54 imsi_dir = opendir(buff);
55 find_directory(imsi_dir, buff, string, ad);
56 }
57 }
58 }
59
60 int isdirectory(char *path) {
61
62 struct stat statbuf;
63
64 if( stat(path, &statbuf)==-1 ) return 0;
65 else return s_isdir(statbuf.st_mode);
66 }
이렇게 뜨네요.. gcc 로 컴파일은 되는뎅.
-
한별나라
13번라인이요
-
분홍이
저 에러는 보통 ; 이게 빠졌을때 나는건데 흠.. 몇번 라인인가요?
-
이퓨리한은지
우웅...
void find_directory(DIR *, char *, char *, char *);를 전부 선언해보죠
void find_directory(DIR *dir, char *path, char *string, char *ad); 로 말이죠 -
보라나
저것도 지웟습니다.ㅠㅠ
-
큐트
14번에 *은 오타인가요...?
보통 저 에러는 어딘가에 오타가 있을 때 종종 발생하곤 합니다. -
시크포텐
그래도 나는데요...
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2700668 | c언어 질문입니다. 도와주세요~ (3) | 가자 | 2025-07-07 |
2700639 | 한글입력받아서 ㄱㄴㄷ순서대로출력하는법좀 | 두빛나래 | 2025-07-06 |
2700610 | 정말 기초적인 더하기,여백 문제 help | 무슬 | 2025-07-06 |
2700562 | 함수포인터에서요 (7) | 소심한여자 | 2025-07-06 |
2700530 | 전처리문 질문입니다. (1) | 아놀드 | 2025-07-05 |
2700510 | c언어를 어케하면 잘할수 있을까요.. | 연연두 | 2025-07-05 |
2700484 | 두 개가 차이가 뭔지 알려주세요...(소수 찾는 프로그램) (2) | 날위해 | 2025-07-05 |
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 |