Displaying files in a particular path in listbox????

This is a discussion on Displaying files in a particular path in listbox???? within the Windows Programming forums, part of the Platform Specific Boards category; I have two list boxes.In first listbox i am supposed to display all the directories in C drive and in ...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    1

    Unhappy Displaying files in a particular path in listbox????

    I have two list boxes.In first listbox i am supposed to display all the directories in C drive and in second listbox if any directory is doubleclicked in listbox1 all the bmp files should be displayed in second listbox.

    I have made first list box in which i am successfully displaying all the directories in C drive and My directories come in form [Windows],[Documents and Settings] ie with braces.

    So further by concatenation i am concatenating C:/[Windows]/*.*
    because of these square braces it is not detecting the path from where to fetch
    the file from.

    My concatenation thing is working in itself as i am able to display all the bmp files if I simply concatenate C:/Windows/*.*

    Someone please help.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,642
    I suppose the easiest thing to do would be to replace the brackets with slashes. Windows typically ignores extra slashes.
    Code:
        char path[] = "C:\\[Windows]\\";
        char *p = path;
        for (; *p; ++p)
        {
            if (*p == '[' || *p == ']')
                *p = '\\';
        }
    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. geting full path of files and folders (boost::filesystem)
    By umen242 in forum C++ Programming
    Replies: 2
    Last Post: 05-18-2008, 11:37 PM
  2. accessing all files in a folder.
    By pastitprogram in forum C++ Programming
    Replies: 15
    Last Post: 04-30-2008, 10:56 AM
  3. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  4. How to cast a ListBox item to an int for a switch statment?
    By Swaine777 in forum C++ Programming
    Replies: 8
    Last Post: 09-26-2004, 08:52 PM
  5. reinserting htm files into chm help files
    By verb in forum Windows Programming
    Replies: 0
    Last Post: 02-15-2002, 08:35 AM

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