Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Dec 2009
    Location
    Wolfville, Nova Scotia, Canada
    Posts
    23
    Thanks
    0
    Thanked 1 Time in 1 Post

    Thumbs up

    I want to develop a program to read my Favorites folder. This is fairly straight-forward, since Favorites are stored in a folder structure in C:\Users\Ron\Favorites. However, when I use Win32 or MFC functions to recursively read the Favorites folders I encounter folder names like "Diving?". First of all, I have no idea where the "?" comes from. Secondly, when I try to search this folder (that is correctly identified as a folder), the search string becomes "C:\Users\Ron\Favorites\Diving?\*.*" and the search fails.

    If I open a command prompt window (RUN cmd) and use the DIR and CD commands I can navigate to the Favorites folder. If I type "CD Diving", the message is that no such directory exists. If I type "CD Diving?", I successfully change folders and then the DIR command shows me the contents of the "Diving?" folder.

    Can anyone suggest why the question mark is appearing at the end of some folder names (and not others) and how to programatically read the contents of this folder? Is this a UNICODE issue and if so, how do I handle it progamatically? (I am using Visual Studio 2008 with C++ and MFC.)

    Thanks for any suggestions.

    Ron

  2. #2
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm wondering if that ? means "I can't print the next character" rather than being an actual part of the filename. Perhaps you could copy/paste some "good" and "bad" Favorites names into a hex editor and see what's going on with any (non-visible?) trailing characters.

    Alan

  3. #3
    New Lounger
    Join Date
    Dec 2009
    Location
    Wolfville, Nova Scotia, Canada
    Posts
    23
    Thanks
    0
    Thanked 1 Time in 1 Post
    The "?" shows up when I watch the variables using a debug run of the program and in the character string that is returned by CFileFind::GetFileName() function. I'll try looking at the character codes.
    Ron

  4. #4
    New Lounger
    Join Date
    Dec 2009
    Location
    Wolfville, Nova Scotia, Canada
    Posts
    23
    Thanks
    0
    Thanked 1 Time in 1 Post
    An update on this:

    It is a UNICODE/wide character issue. After leaving it for a few months I decided to tackle the problem again. I started with a new project and chose to enable UNICODE. The FindFirstFile and FindNextFile (using WIN32_FIND_DATA) work just fine using wchar_t strings (also the _T(string) conversion macro). Since the problem started with my switch to Windows Vista and remained in Windows 7, that was the biggest clue for me that it might have been the wide character string issue.

    Hope this helps anyone else programming for the Win7 environment.

    Ron

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •