The following NewLISP code shows me the file attributes of files under Win32. However, some of the filenames retrieved have Chinese characters in the name. When the GetFileAttributesA function encounters them, it gives me a -1 for the attribute. I looked at GetFileAttributesW but don't know how to make the contents of the fname available to the function in a form it recognises.
How does one handle this situation? (I am willing to consider trying another language)
(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")