Help

This is a discussion on Help within the C++ Programming forums, part of the General Programming Boards category; I want to write a program, which searches all the text files in a given directory & stores their paths ...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    112

    Help

    I want to write a program, which searches all the text files in a given directory & stores their paths and names in a array.

    PHP Code:
    #include<iostream>
    #include<io.h>
    using namespace std;



    int main()
    {
        
    struct _finddata_t fileinfo;
        const 
    char *filespec;

        
    int done;
        
    cout<<_findfirst("*.TXT", &fileinfo ); 
        
         

        return 
    0;


  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,409
    Fatima, what is it with your posts, you have written over 80 and still are not being any more descriptive

  3. #3
    Registered User
    Join Date
    Oct 2009
    Location
    While(1)
    Posts
    377
    What u can do write a code like this....

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    int main() {
        system("find . -name '*.txt' > output");
        return 0;
    }
    which will create a file output which will have data like

    [code]
    ./a.txt
    ./temp_dor/e.txt
    ./temp_dor/g.txt
    ./temp_dor/d.txt
    ./b.txt
    ./c.txt
    [code]

    than just parse the file
    output
    to put everything in the array as u want....

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,451
    This is getting boring.
    Reposting the same question (and the same useless title) in a different colour doesn't work.

    Respond here with some actual effort.
    Help

    Closed.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

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