무슨 에러인지좀 봐주셔요
돌심장
질문 제목 : 질문 내용 :
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번에 *은 오타인가요...?
보통 저 에러는 어딘가에 오타가 있을 때 종종 발생하곤 합니다. -
시크포텐
그래도 나는데요...
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2692343 | scnaf에 자꾸 선언을 참조하라는데;; (8) | 도래 | 2025-04-22 |
2692282 | 도스상에서 생성된 exe파일에 press~ 뜨게 하기 (4) | 회사원 | 2025-04-21 |
2692256 | scanf("%*c"); ㅠㅠ 고수님들 | 거북이 | 2025-04-21 |
2692230 | 하노이탑 질문입니다. (1) | 미쁘다 | 2025-04-21 |
2692210 | 정보 올림피아드 문제인데.. 풀이 과정이 궁금합니다.(재귀함수) (5) | 물티슈 | 2025-04-20 |
2692144 | C언어와 리눅스에 대한 질문입니다. | 싴흐한세여니 | 2025-04-20 |
2692114 | 컨텍스트 스위칭하는데 걸리는 시간 측정.. | YourWay | 2025-04-19 |
2692086 | 간접참조 연산자, 증감연산자 질문이용! (2) | 블랙캣 | 2025-04-19 |
2692056 | 주석좀 달아주세요. 몇개적엇는데 몇개만달아주세요. (2) | DevilsTears | 2025-04-19 |
2691978 | 진수 쉽게 이해하는법... (3) | 지지않는 | 2025-04-18 |
2691949 | getchar() 한 문자를 입력받는 함수 질문 | 채꽃 | 2025-04-18 |
2691919 | 배열 정렬 및 합치기 질문입니다. | 사과 | 2025-04-18 |
2691845 | c언어왕초보 질문이 있습니다........ | 루나 | 2025-04-17 |
2691815 | void add(int num); 함수... (4) | 살랑살랑 | 2025-04-17 |
2691756 | 명령 프롬프트 스크롤바가 없어요 | 두메꽃 | 2025-04-16 |
2691725 | 자료구조에 관련해서 질문이 있어 글을 올립니다. | 누리알찬 | 2025-04-16 |
2691697 | if 문에서 구조체 배열에 저장되있던 문자열 검사하는 법 ? (2) | 민트맛사탕 | 2025-04-16 |
2691678 | C언어 함수 질문이요~!!! | 연보라 | 2025-04-15 |
2691650 | 반복문 | 돋가이 | 2025-04-15 |
2691618 | 링크드리스트 개념 질문이예요 (3) | 맨마루 | 2025-04-15 |