On Nov 10 10:58, Corinna Vinschen wrote: > On Nov 9 22:18, Leon Vanderploeg wrote: > > Many thanks to Charles and Corinna for the help. I have modified the > > code to use the POSIX functions. I still have one problem I cannot > > seem to conquer. > > > > I need to be able to read and write the (yes, I know it's evil) > > archive bit. Unless there is a POSIX function (which I seriously > > doubt) for these items, I am locked into the windows APIs. > > > > I have read and re-read the Cygwin documentation on > > internationalization at least 6 times and I cannot figure out what I > > need to do to get this to work. I have tried numerous combinations of > > environment variables and locale settings in the code, but none of > > them work. The windows API fails to find the file specified. I just > > want US English that can handle the extended character set to the > > windows APIs. In this case, let's use the example of the copyright > > symbol (the small c with a circle around it). What needs to be set in > > the environment, and what needs to be set in the C code to handle > > these characters correctly? > > Nothing. Just use always the UNICODE API, rather than the ANSI API: > > #include <sys/cygwin.h> > > DWORD > my_GetFileAttributes (const char *cygwin_multibyte_filename) > { > DWORD attr = INVALID_FILE_ATTRIBUTES; > PWCHAR w32_filename = cygwin_create_path (CCP_POSIX_TO_WIN_W, > cygwin_multibyte_filename); > if (w32_filename) > { > attr = GetFileAttributes (w32_filename);
Sigh. Please make that attr = GetFileAttributesW (w32_filename); Note the trailing W. > free (w32_filename); > } > return attr; > } Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple