2 Simple questions 
July 22nd, 2005, 04:15 PM
| | | |
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 | 
July 22nd, 2005, 04:15 PM
| | | | re: 2 Simple questions
nooria posted:
[color=blue]
> 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"};[/color]
[color=blue]
>
> 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.[/color]
This is platfrom specific. If you're running Windows, then use the
functions:
FindFirstFileEx
FindNextFileEx
FindClose
-JKop | 
July 22nd, 2005, 04:15 PM
| | | | re: 2 Simple questions
"nooria" <nooria@saic.com> wrote in message news:40d91f75@cpns1.saic.com...[color=blue]
> 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++){
>
> }
>[/color]
You can find out the size of any array like this
sizeof FilePath/sizeof FilePath[0]
john |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,702 network members.
|