Thread: Help

  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,472
    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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    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.

Popular pages Recent additions subscribe to a feed