Hello group, What do I need to do to comile the following code in D2009. Compiler error after the Else E2010: Incompatible Types 'AnsiChar' and 'Char' if isUnicode then SearchHandle := FindFirstFilew( PWideChar( fn ), FindDataW ) else SearchHandle := FindFirstFile( PAnsiChar( Ansistring( fn ) ), FindDataA ); <<<<<compiler error in the above line >>>>>>>>>>> Regards, Bryan
![]() |
0 |
![]() |
> What do I need to do to comile the following code in D2009. > Compiler error after the Else > E2010: Incompatible Types 'AnsiChar' and 'Char' > > if isUnicode then > SearchHandle := FindFirstFilew( PWideChar( fn ), FindDataW ) > else > SearchHandle := FindFirstFile( PAnsiChar( Ansistring( fn ) ), > FindDataA ); <<<<<compiler error in the above line >>>>>>>>>>> Why on earth are you doing this? Just use SearchHandle := FindFirstFile( PChar( fn ), FindData) and you will compile perfectly across both D7 and D2009, assuming FindData is declared as the generic TWin32FindData too. -- Chris Rolliston http://delphihaven.wordpress.com/
![]() |
0 |
![]() |
Thanks for your help! Bryan "Chris Rolliston" <spam@gmail.com> wrote in message news:236333@forums.embarcadero.com... >> What do I need to do to comile the following code in D2009. >> Compiler error after the Else >> E2010: Incompatible Types 'AnsiChar' and 'Char' >> >> if isUnicode then >> SearchHandle := FindFirstFilew( PWideChar( fn ), FindDataW ) >> else >> SearchHandle := FindFirstFile( PAnsiChar( Ansistring( fn ) ), >> FindDataA ); <<<<<compiler error in the above line >>>>>>>>>>> > > Why on earth are you doing this? Just use > > SearchHandle := FindFirstFile( PChar( fn ), FindData) > > and you will compile perfectly across both D7 and D2009, assuming > FindData is declared as the generic TWin32FindData too. > > -- > Chris Rolliston > http://delphihaven.wordpress.com/
![]() |
0 |
![]() |