tyloya Master

Registrado: 20 Ago 2002Mensajes: 175
|
Publicado: Vie 06 Jun, 2003 5:12 pm Asunto: Libreria netinet/in.h |
|
|
Hola
Qué librería puedo usar en lugar de //#include <netinet/in.h>?
Es que el código que estoy usando me lo bajé para linux y ahora
lo he adaptado a Builder C++ 5,.
En un fichero "install" que lleva dice lo siguiente:....y no sé si cumplo los requisitos....trabajo en Windows98 con Builder C++ 5
4) Edit the Makefile. Set CC accordingly. Set CFLAGS accordingly. Some sample CFLAGS lines for several different compilers/machines are given in the Makefile. If long's on your machine are 32 bits but int's are NOT 32 bits, then you must include the -DLONG_32 option in your CFLAGS line. If your system does not have the netinet/in.h header, then you must add either -DFORCE_BIG_ENDIAN or -DFORCE_LITTLE_ENDIAN to the CFLAGS line (which you use depends on your machine).
Pero no entiendo dónde tengo que añadir esta línea DFORCE BIG_ENDIAN.........O LA OTRA LÍNEA.
Otro problema relacionado es que en el fichero Byteorder.h, aparece la definición de una función htonl, esta función la debo usar en otro fichero bitio.c, y para ello hago un #include byteorder.h en bitio.c,........el problema es que en bitio.c, me da un errorde compilación que dice lo siguiente:
[Linker Error] Unresolved external '_htonl' referenced from C:\WINDOWS\ESCRITORIO\BMT1R1MPEG\MPEG 28-5-03\NUEVO MPEG-4-6-03\BITIO.OBJ
No lo entiendo porque en bitio.c tengo incluido el fichero byteorder.h que es donde se define la función htonl.
¿Qué puedo hacer?
FICHERO BYTEORDER.H.
#include "general.h"
#ifdef FORCE_BIG_ENDIAN
/* leave byte order as it is */
#define htonl(x) (x)
#define ntohl(x) (x)
#define htons(x) (x)
#define ntohs(x) (x)
#else
#ifdef FORCE_LITTLE_ENDIAN
/* need to reverse byte order */
/* note -- we assume here that htonl is called on a variable, not a
* constant; thus, this is not for general use, but works with bitio.c
*/
#define htonl(x) \
((((unsigned char *)(&x))[0] << 24) | \
(((unsigned char *)(&x))[1] << 16) | \
(((unsigned char *)(&x))[2] << | \
(((unsigned char *)(&x))[3]))
#define ntohl(x) htonl(x)
#define htons(x) \
((((unsigned char *)(&x))[0] << | \
((unsigned char *)(&x))[1])
#define ntohs(x) htons(x)
#else
/* let in.h handle it, if possible */
#include <sys/types.h>
file://#include <netinet/in.h>
#endif /* FORCE_LITTLE_ENDIAN */
#endif /* FORCE_BIG_ENDIAN
El caso es que mi aplicación debe escribir datos de cabecera en hexadecimal para generar una secuencia de vídeo mpeg, pero si los bytes los escribe en otro orden no reconoce la secuencia de video y no puede visualizarse.
Muchas gracias de antemano |
|