2 Simple questions

Discussion in 'C++' started by nooria, Jun 23, 2004.

  1. nooria

    nooria Guest

    1. How do you find out the length of the following GStrings?

    GString FilePath [] = {"UnSigned\\EF.DG1", "UnSigned\\EF.DG2",
    "UnSigned\\EF.DG3", "UnSigned\\EF.DG4", "UnSigned\\EF.DG5"};

    I know the length is 5 but I like to find out dynamically. For example,
    I want to use that GString in a for loop.

    for (int i =0; i<(I want to put the length of the file Path here); i++){

    }


    2. How can you search a directory to see how many files with what kind
    of extensions are in that directory?

    For example, I have the following directory c:\myapp; I don't know how
    many files are there or with what extensions.

    Thanks in advance
     
    nooria, Jun 23, 2004
    #1
    1. Advertising

  2. nooria

    JKop Guest

    nooria posted:

    > 1. How do you find out the length of the following GStrings?
    >
    > GString FilePath [] = {"UnSigned\\EF.DG1", "UnSigned\\EF.DG2",
    > "UnSigned\\EF.DG3", "UnSigned\\EF.DG4", "UnSigned\\EF.DG5"};


    >
    > I know the length is 5 but I like to find out dynamically. For example,
    > I want to use that GString in a for loop.
    >
    > for (int i =0; i<(I want to put the length of the file Path here); i++){
    >
    > }
    >
    >
    > 2. How can you search a directory to see how many files with what kind
    > of extensions are in that directory?
    >
    > For example, I have the following directory c:\myapp; I don't know how
    > many files are there or with what extensions.


    This is platfrom specific. If you're running Windows, then use the
    functions:

    FindFirstFileEx
    FindNextFileEx
    FindClose


    -JKop
     
    JKop, Jun 23, 2004
    #2
    1. Advertising

  3. "nooria" <> wrote in message news:...
    > 1. How do you find out the length of the following GStrings?
    >
    > GString FilePath [] = {"UnSigned\\EF.DG1", "UnSigned\\EF.DG2",
    > "UnSigned\\EF.DG3", "UnSigned\\EF.DG4", "UnSigned\\EF.DG5"};
    >
    > I know the length is 5 but I like to find out dynamically. For example,
    > I want to use that GString in a for loop.
    >
    > for (int i =0; i<(I want to put the length of the file Path here); i++){
    >
    > }
    >


    You can find out the size of any array like this

    sizeof FilePath/sizeof FilePath[0]

    john
     
    John Harrison, Jun 23, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ali Syed
    Replies:
    3
    Views:
    584
    Mark McIntyre
    Oct 13, 2004
  2. pkirk25
    Replies:
    50
    Views:
    1,169
    Bill Pursell
    Oct 4, 2006
  3. Replies:
    10
    Views:
    583
  4. Vijay
    Replies:
    2
    Views:
    664
    Öö Tiib
    May 7, 2010
  5. reema
    Replies:
    0
    Views:
    313
    reema
    Aug 26, 2008
Loading...

Share This Page