Try using _wcsdup instead of _strdup.

Regards
Mansur

________________________________
From: Gus Vincent Dato <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, November 13, 2008 6:10:17 AM
Subject: Re: [c-prog] Passing variables


return _strdup(FindFileDat a.cFileName) ;

error C2664: '_strdup' : cannot convert parameter 1 from 'WCHAR [260]' to 
'const char *'

i also need to pass the handle for my FindNextFile Function.

Thanks for the help.

____________ _________ _________ __
From: Thomas Hruska <[EMAIL PROTECTED] .com>
To: [EMAIL PROTECTED] com
Sent: Wednesday, November 12, 2008 21:41:35
Subject: Re: [c-prog] Passing variables

Gus Vincent Dato wrote:
> somehow the code gets trashed. here it is:
> 
> char* FFF(TCHAR FilePath[MAX_ PATH])
> {
>  WIN32_FIND_DATA FindFileData;
>  HANDLE hFind;
>  hFind = FindFirstFile( FilePath, &FindFileData) ;
>  if (hFind == INVALID_HANDLE_ VALUE)
>   return _strdup("ERROR" );
>  else {
>   return _strdup(FindFileDat a.cFileName) ;
>  }
> }

What are the errors?  You are also leaking a handle on every call to the 
function - you have to free handles (usually with the CloseHandle( ) API).

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleS oft.com/MyTaskFo cus/


      

Reply via email to