FindNextFile & File names containing foreign characters

This is a discussion on FindNextFile & File names containing foreign characters within the Windows Programming forums, part of the Platform Specific Boards category; Hi, Presently have a working application that just hit an issue with filenames that contain foreign characters. When doing a ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Location
    Nashua, NH
    Posts
    2

    FindNextFile & File names containing foreign characters

    Hi,

    Presently have a working application that just hit an issue with filenames that contain foreign characters. When doing a loop with FindNextFile, those characters are shown as "?" question marks. So when we try to open the file, we get an error later on. Doing Dir in the directory where the file is located, we see this.

    12/15/2009 12:51 PM <DIR> .
    12/15/2009 12:51 PM <DIR> ..
    12/07/2002 11:12 AM 20,480 ???? ????? ??????.doc

    So even trying to use NotePad from the console, we get an error cause those are not the right chacters. If you use the FileOpen dialog, you can open the file though, and you will see those special characters. So wondering if there is a way to retrieve a file name properly here using FindNextFile, or if we need to use something else. If so, what.

    Thanks.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,652
    Use WIN32_FIND_DATAW and FindNextFileW.
    Then send the file name through CreateFileW(), _wfopen(), or basic_fstream(const wchar_t*).

    You could also define "UNICODE" and "_UNICODE" (using project settings) so that "wide" interfaces and structures are automatically used.

    gg

  3. #3
    Registered User
    Join Date
    Dec 2009
    Location
    Nashua, NH
    Posts
    2
    Thank you

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Counting the characters from each word from a text file
    By flipguy_ph in forum C Programming
    Replies: 6
    Last Post: 04-27-2009, 05:56 PM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  3. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  4. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21