Thread: read file list into array

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    7

    read file list into array

    what i want to do is get a list of the files and folders within a folder and put the list in an array
    i was able to do it in VB.NET and it was easy... but now i want to do it with C.
    i know i could do it with something like

    Code:
    system("ls >> file_list")
    ...read the file list into an array
    is there a way to take out that step and just read a list of all the folders and files directly into an array?
    I dont know what to call what Im trying to do, so if someone could just point me in the right direction i'm not scared of reading about it
    thanks

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    A start:
    FAQ > How do I... (Level 3) > Accessing a directory and all the files within it
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  2. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. Read from file to an array
    By brooklyn1126 in forum C++ Programming
    Replies: 2
    Last Post: 05-15-2004, 08:32 PM
  5. How can I traverse a huffman tree
    By carrja99 in forum C++ Programming
    Replies: 3
    Last Post: 04-28-2003, 05:46 PM