2 Simple questions

N

nooria

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
 
J

JKop

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
 
J

John Harrison

nooria said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top