Thread: is it possible?

  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    14

    is it possible?

    Hello there, i have this task at college...i need to write a script with c++. There's this specific folder, where documents are... its like c:\bandau\male\male001\*.* and it goes till male010 folders... the same thingy is with c:\bandau\female\female001\*.* and so on... so i have to make this menu...if you choose 1 - then programme have to write all the male00* directorys...for egz: c:\bandau\male\male001 ; c:\bandau\male\male001 etc.
    i wanted to know how to start the script? how do i make it search exact directory for folders, who has "male" in the name?

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    Get a list of directories, search for "male" or "female" in each.

  3. #3
    Registered User
    Join Date
    Nov 2009
    Posts
    14
    how do i get a list? what funcion do i use for it?

  4. #4
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229

  5. #5
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Your first stop should be FindFirstFile, if I'm not mistaken.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  6. #6
    Registered User
    Join Date
    Nov 2009
    Posts
    14
    anon, thank you m8, ill try to find the answer there. But is it possible to make it all very simple?? to do the program as simple as it can be?? to begin with like..if i write a specific location it shows me whats in it?

  7. #7
    The larch
    Join Date
    May 2006
    Posts
    3,573
    It's just not particularly simple (you might be better off with another language, if it doesn't have to be C++).

    If you follow the links from that reference, you might also find snippets how to read the entire contents of a directory.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  8. #8
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    C++ isn't a scripting language. The code you write with C++ is called "code". If you want to write a "script" then you need a scripting language.

    If you want to use C++ then it won't be any simpler than the impressions you'll get from the links provided.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  9. #9
    Registered User
    Join Date
    Nov 2009
    Posts
    14
    Alright, thank you guys, ill keep searching for what i need. btw, i'm working with dev c++ and only with console application. sry, i will call it code now. :P if you have any example of code which would show all the content inside a folder, please paste it. thank you

Popular pages Recent additions subscribe to a feed