Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using FindFirstFile and FindNextFile
#6
Hello Gintaras,
As you said i have done some out calls to debug my code, but now I have two questions about Unicode( I think I am doing something wrong with the memory or have memory leaks, because sometimes my program run, and sometimes my program closes unexplectly)

1.- What is the right way to get the cFileName with WIN32_FIND_DATAW i am using the following code:
Function get_folder_size
Code:
Copy      Help
str s.ansi(&struFind.cFileName)
(Where struFind is an instance of WIN32_FIND_DATAW structure, at this time I have executed this code
Code:
Copy      Help
int threadFind=FindFirstFileW(trueFilter,&struFind)
at first, and trueFilter is now a BSTR) is it ok??

When I tried to add struFind.CFileName directly to a BSTR with "add" method it got a number, i guess a pointer or reference and appends it as a part of the string.


2.- a BSTR does not need to be initialized is it right? like this:
Function get_folder_size
Code:
Copy      Help
,,,str s.ansi(&struFind.cFileName)
,,,BSTR childFolder=""
,,,childFolder.add(folder)
,,,childFolder.add("\")
,,,childFolder.add(s)

I have tried to make a chidlFolder.alloc(800), but also my program closes.

Thank you.
Regards.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)