directory and file crawl

This is a discussion on directory and file crawl within the C++ Programming forums, part of the General Programming Boards category; I created a program in Perl that crawls through a directory and outputs all folder and file names to a ...

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    7

    Lightbulb directory and file crawl

    I created a program in Perl that crawls through a directory and outputs all folder and file names to a text document.

    I want to create the same program in c++ but I do not know how to write the code in c++ that can find and search through dirctories and files. I only know how to open and write to a file that is in the same folder as my program.

    I'm on a windows machine using Borland 5.5.

    thanks to any who can help

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    search the boards for salems directory walker. Its been posted a few times now. With a few slight modifications it can dump to a text file. Also check the FAQ.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Bios Raider biosninja's Avatar
    Join Date
    Jul 2002
    Location
    South Africa
    Posts
    765
    Here is the dos command line fior it

    in c:\ do : "dir *.* /s/a >list.txt"

    just put that into the "system" function in your code
    The knack of flying is learning to throw yourself at the ground and miss.

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    7

    response to vVv

    Thanks for the reply vVv

    I tried to compile the code on my windows box with borland 5.5 and it had numerous compile errors.

    Shoul this code work on my setup?

    thanks

  5. #5
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    He said it was for Linux, so it probably won't compile on Windows.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Couple errors please help :-D
    By JJJIrish05 in forum C Programming
    Replies: 9
    Last Post: 03-06-2008, 02:54 AM
  2. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 04:44 PM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 09:39 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 05:10 PM

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