씨언어 오류좀 고쳐주시겠습니까?
#include "stdio.h"
#include "string.h"
#include "dos.h"
#include "stdlib.h"
#include "io.h" //FILE_SEARCH file_search;
#include "direct.h" //getcwd
typedef struct _finddata_t FILE_SEARCH;
#define _CRT_SECURE_NO_WARNINGS
#define MAXPATH 80
#define ALL_ATTRIB (FA_RDONLY || FA_HIDDEN || FA_SYSTEM || FA_LABEL || FA_DIREC || FA_ARCH); // 여기 정의 해두었는데 왜 선언되지 않은 식별자라고 오류가 뜨는겁니까??
/* 모든 속성을 지정 */
void fileListPrint(char *path, FILE_SEARCH *file_search);
struct ffblk {
char ff_reserved[21]; /* reserved by DOS */
char ff_attrib; /* attribute found */
int ff_ftime; /* file time */
int ff_fdate; /* file date */
long ff_fsize; /* file size */
char ff_name[13]; /* found file name */
};
/*/////////////////////////////////////////////////////////////////////////
FUNCTION void findfile (char *mask)
PURPOSE Processes messages for the main window.
COMMENTS
인자로 파일 마스크를 받아 전 디렉토리를 뒤져서
파일 마스크에 일치하는 파일을 화면으로 출력한다.
현재의 디렉토리에서 파일을 다 찾았으면 서브 디렉토리로 추적해
다시 파일을 찾는 과정을 반복하다가 서브 디렉토리를 다 찾으면
다시 상위 디렉토리로 돌아오는 재귀적 과정을 되풀이 한다.
/////////////////////////////////////////////////////////////////////////*/
void main(int argc, char *argv[])
{
FILE_SEARCH file_search; // FILE_SEARCH 구조체 변수 file_search 선언! #include
char buf[20]={0,};
if(argc != 2) // argc가 2가 아니라면/
{
printf("Usage : %s \n", argv[0]);
exit(0); // #include
}
// buf[0]='\\';
// strcpy();
fileListPrint(argv[1], &file_search); // 파일 경로, 파일정보 인자 전달
// argv[1] : 파일 경로
// &file_search : 파일 정보
}
void fileListPrint (char *path, FILE_SEARCH *file_search)
{
char buf[512]; /* 현재 경로를 저장할 공간 */
long h_file=0L;
struct ffblk info;
int countFile=0;
if((h_file = _findfirst(buf, file_search)) == -1L) //
printf("파일이 존재하지 않습니다!\n");
if (_findfirst(path, info, ALL_ATTRIB) == 0) // 여기서 오류가 납니다
{
do {
getcwd(path, MAXPATH); /* 현재의 경로를 얻음 */
printf ("\nTEST MASK [%d] : [%s]", countFile++, path); /* TEST */
printf ("\n%s%s%s\n", path, /* 출력 : 현재의 경로 + (\) + 파일명 */
strlen(path) == 3 ? "" : "\\", info.ff_name);
/* root \ sub */
} while(_findnext(h_file , info.ff_fdate) == 0); // <-----------특히 이부분에서 잘 모르겠네요..
}
}
댓글 달기