다음 NewLISP 코드는 Win32에서 파일의 파일 특성을 보여줍니다. 그러나 검색된 일부 파일 이름에는 이름에 중국어 문자가 있습니다. GetFileAttributesA 함수가 그것들을 만났을 때, 속성에 -1을 준다. GetFileAttributesW를 살펴 보았지만 fname의 내용을 함수가 인식 할 수있는 형식으로 사용하는 방법을 모릅니다.NewLISP를 사용하여 중국어 파일 이름 속성 찾기?
이 상황을 어떻게 처리합니까? (다른 언어를 사용해 볼 의향이 있습니다)
(define (get-archive-flag file-name)
(if (not GetFileAttributesA)
(begin
(import "kernel32.DLL" "GetFileAttributesA")
)
)
(setq fname file-name file-attrib (GetFileAttributesA (address fname)))
(append fname " " (string file-attrib))
)
; walks a disk directory and prints all path-file names
;
(define (show-tree dir)
(if (directory dir)
(dolist (nde (directory dir))
(if (and (directory? (append dir "/" nde))
(!= nde ".") (!= nde ".."))
(show-tree (append dir "/" nde))
(println (get-archive-flag (append dir "/" nde)))
)
)
)
)
(show-tree "z:\\working files\\Cathy")