Xevi,
Puedes eliminar el Warning así:
if( gethostname( cHost, 256 ) == 0 )
{
h = gethostbyname( cHost );
if( h )
while( h->h_addr_list[ nAddr ] )
nAddr++;
}
Saludos,
Pedro Gil
"Xevi" <
xevicomas@terra.es> escribió en el mensaje news:[email=
448dd161@ozsrvnegro.ozlan.local...]
448dd161@ozsrvnegro.ozlan.local...[/email]
Bingen...
Lo he incluido en mi fichero de Wrappers...
Compilant Wrappers.prg...
Warning W8060 Wrappers.prg 142: Possibly incorrect assignment in function HB_FUN_GETLOCALIP
Enllaçant GWin.exe...
1 Warnings, 0 Errors
La línea en cuestión es esa...
if( h = gethostbyname( cHost ) )
¿Y eso???
¿Un posible error???
Ahora... eso si, funciona !!!
Gracias.
Un Saludo,
Xevi.
"bingen" <
bingen@muninser.com> ha escrit al missatge del grup de discussió: [email=
448d8c03@ozsrvnegro.ozlan.local...]
448d8c03@ozsrvnegro.ozlan.local...[/email]
> Mete este churro C en un PRG cualquiera y le llamas como si fuera una
> simple función cIP:=GetLocalIP()
>
> //---------------------------------------------------------- --------------------
>
> #pragma BEGINDUMP
>
> #include "windows.h"
> #include "xailer.h"
> #include "winsock2.h"
>
> XA_FUNC( GETLOCALIP )
> {
> WSADATA wsa;
> char cHost[256];
> struct hostent *h;
> int nAddr = 0, n = 0;
>
> WSAStartup( MAKEWORD( 2, 0 ), &wsa );
>
> if( gethostname( cHost, 256 ) == 0 )
> if( h = gethostbyname( cHost ) )
> while( h->h_addr_list[nAddr] )
> nAddr++;
>
> hb_reta( nAddr );
>
> if( nAddr )
> while( h->h_addr_list[n] )
> {
> char cAddr[256];
> wsprintf( cAddr, "%d.%d.%d.%d", (BYTE) h->h_addr_list[n][0],
> (BYTE) h->h_addr_list[n][1],
> (BYTE) h->h_addr_list[n][2],
> (BYTE) h->h_addr_list[n][3] );
> hb_storc( cAddr, -1, ++n );
> }
>
> WSACleanup();
>
> }
>
> #pragma ENDDUMP
>
--