|
-
Dec 24th, 2000, 03:25 PM
#1
Thread Starter
Frenzied Member
Can someone translate this code i got from Jop to C++. I am having most trouble with the dinamyc arrays.
Code:
Public Sub GetAllFilesAPI(StartDir As String)
Dim d$, dr As Boolean, dts As Boolean, dirs() As String
Dim FindData As WIN32_FIND_DATA, c%, file&
If Right(StartDir, 1) <> "\" Then StartDir = StartDir & "\"
ReDim dirs(0)
file = FindFirstFile(StartDir & "*", FindData)
c = 1
Do While c <> 0
c = FindNextFile(file, FindData)
d = StripNulls(FindData.cFileName)
dts = d <> "." And d <> ".." And Len(d) > 0
If dts Then dr = (GetFileAttributes(StartDir & d) And FILE_ATTRIBUTE_DIRECTORY)
If dr = False And dts Then Form1.List1.AddItem StartDir & d 'add to list
If dr And dts Then 'dir found
ReDim Preserve dirs(UBound(dirs) + 1)
dirs(UBound(dirs)) = d
End If
Loop
Dim x&
FindClose file
For x = 1 To UBound(dirs)
GetAllFilesAPI StartDir & dirs(x)
Next x
End Sub
-
Dec 24th, 2000, 04:13 PM
#2
Frenzied Member
-
Dec 24th, 2000, 04:55 PM
#3
Monday Morning Lunatic
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 24th, 2000, 05:12 PM
#4
this is a good a time as any to ask........... how do you use a vector?
-
Dec 25th, 2000, 01:04 PM
#5
Monday Morning Lunatic
vector is a template class, so you can make a vector of anything:
Code:
vector<int> viArray;
for(int j = 0; j < 10; j++) {
viArray.push_back(j);
}
for(j = 0; i < viArray.size(); j++) {
cout << " " << viArray[j];
}
cout << endl;
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 25th, 2000, 01:11 PM
#6
I pretty much tought my self how to use vectors in the past.. day... but what is push_back and push_forward(or whatever it's called) ??
-
Dec 25th, 2000, 02:32 PM
#7
Monday Morning Lunatic
push_back appends an item to the vector.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 25th, 2000, 05:06 PM
#8
Thread Starter
Frenzied Member
Thanks parksie. I finally translated that VB code. This vector stuff really helped a lot. Thanks again.
-
Dec 25th, 2000, 05:15 PM
#9
:doh!:
so I've been resizing and adding to my vectors for no reason?
well, thanks parksie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|