Hey peeps, I have a q...
I'm trying to convert a function I wrote in VB (yesss the one Vlatko has converted too, that was mine)
I was just beginning and was bouncing on an error already
Code:void GetAllDirs(char cDirIn[256]) { char d[256]; bool dr, dts; long File; int c; WIN32_FIND_DATA FindData; File = FindFirstFile(lstrcat(cDirIn, "*"), FindData); if (File = -1) cout << "****!"; }
I'm getting this error
I've included windows.h & iostream.h, so the functions can be calledCode:--------------------Configuration: ROKv2 - Win32 Debug-------------------- Compiling... main.cpp C:\Jop\Vc++\ROKv2\main.cpp(21) : error C2664: 'FindFirstFileA' : cannot convert parameter 2 from 'struct _WIN32_FIND_DATAA' to 'struct _WIN32_FIND_DATAA *' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called Error executing cl.exe. ROKv2.exe - 1 error(s), 0 warning(s)
As you might notice I'm really new in C++ so please help me
thanx.
Oh vlatko, can you please give me the converted code (the Function I gave you (the GetAllDirs from my file module))
Thanks guys!
You translated it right?
(Editing)
By the way, here's the VB code for my function:
ThanxCode:Public Sub GetAllFiles(startdir As String, Lst As ListBox) 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 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 Lst.AddItem startdir & d 'add to list If dr And dts Then ReDim Preserve dirs(UBound(dirs) + 1) dirs(UBound(dirs)) = d End If Loop Dim x& FindClose File For x = 1 To UBound(dirs) GetAllFiles startdir & dirs(x), Lst Next x End Sub
[Edited by Jop on 01-05-2001 at 09:31 AM]




)

Reply With Quote