directories

This is a discussion on directories within the C++ Programming forums, part of the General Programming Boards category; hi guys, im quite new to c++ and i ve only written bits of code for college as examples, but ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    64

    directories

    hi guys,

    im quite new to c++ and i ve only written bits of code for college as examples, but no full apps now i want to write something useful for a change.

    i want to write a program to list whats in a directory with a command, like dir in dos, how would i list whats in a directory and check to see whether or not a directory is valid.

    thanks a lot.

    Shakespeare.

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,681
    It would help a bit if you let us know what OS you are developing your app for and what compiler you will be using.
    I used to be an adventurer like you... then I took an arrow to the knee.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    64
    i'm developing in Windows XP and using ms Visual studio

  4. #4
    dragon
    Guest

    same problem

    I have the same problem, but I'm using Linux/g++!

  5. #5
    Unregistered 4444
    Guest
    Somebody told me I could do something like this for windows

    You need to fill a WIN32_FIND_DATA struct with a call to FindFirstFile() and then iterate through the directory with FindNextFile() until it returns INVALID_HANDLE_VALUE. Each time FindNextFile() returns sucessfully the filename will be a member of the WIN32_FIND_DATA struct which you could use to fill an array. You'll need to include windows.h; search the boards/MSDN for an example if needed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Comparing 2 directories
    By Opel_Corsa in forum C++ Programming
    Replies: 4
    Last Post: 01-19-2007, 10:30 PM
  2. VC6 directories
    By Magos in forum Tech Board
    Replies: 0
    Last Post: 03-11-2005, 04:52 PM
  3. problem while opening files from multiple directories
    By V.G in forum Windows Programming
    Replies: 2
    Last Post: 11-08-2004, 02:29 PM
  4. mkdir and multiple directories
    By Idle in forum C Programming
    Replies: 4
    Last Post: 06-28-2003, 04:56 AM
  5. Working with directories...
    By C Seņor in forum C Programming
    Replies: 4
    Last Post: 04-20-2002, 11:45 AM

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