Connecting Tech Pros Worldwide Help | Site Map

2 Simple questions

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 22nd, 2005, 03:15 PM
nooria
Guest
 
Posts: n/a
Default 2 Simple questions

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

  #2  
Old July 22nd, 2005, 03:15 PM
JKop
Guest
 
Posts: n/a
Default 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
  #3  
Old July 22nd, 2005, 03:15 PM
John Harrison
Guest
 
Posts: n/a
Default 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


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

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 220,840 network members.