강호의도리의 블로그
글쓰기
로그인
회원가입
강호의도리
c언어
팔로우
통계
작성한 글
1
작성 댓글
0
가입 그룹
0
글
태그
댓글
팔로잉
팔로워
강호의도리
· 2년전
질문
io.h 파일 이름 출력에 관해서 질문할 것이 있습니다
#include <stdio.h> #include <string.h> #include <io.h> #include <time.h> #include <stdlib.h> #define _CRT_SECURE_NO_WARNINGS typedef struct _finddata_t FILE_SEARCH; void GetfileList(char* path, char *filename) { long h_file; char search_Path[100]; FILE_SEARCH file_search; sprintf_s(search_Path, "%s/*.PNG", path); if ((h_file = _findfirst(search_Path, &file_search)) == -1L) { printf("파일 없음... ...\n"); } else { do { filename = file_search.name; printf("%s\n", file_search.name); printf("%s\n", filename); } while (_findnext(h_file, &file_search) == 0); _findclose(h_file); } } int main() { char filename[100]; char path[100] = "C:/DEV/picture"; GetfileList(path,filename); printf("%s", filename); } 여기서 왜 파일이름이 1개 밖에 출력되지 않나요..? do{ }while; 이부분이 문제인 것 같긴한데 왜 안되는지 모르겠습니다. 느낌상으론 한번 출력하고 오버플로가 뜨는 것 같은데 왜 뜨는지도 모르겠고;; 정말 하나도 모르겠습니다. 목표가 폴더안에 들어있는 파일 이름들과 개수를 출력하는것인데, 한번 출력하고 되지 않습니다. 부탁드립니다. 새로운 방법이 있다면 알려주시면 감사합니다.
920
1
1
0
아래
·
2023-03-13
https://stackoverflow.com/questions/41844603/access-violation-continuously-thrown-by-findnext-c
더 보기