-
-
Save parzibyte/828be61e28de0dbeb4f1658ab9516dd8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Extraer lo que hay entre <body> y </body> | |
const char inicioEtiqueta[] = "<body>"; | |
const char finEtiqueta[] = "</body>"; | |
size_t longitudInicioEtiqueta = strlen(inicioEtiqueta); | |
char *punteroInicio = strstr(contenido, inicioEtiqueta) + longitudInicioEtiqueta; | |
char *punteroFin = strstr(contenido, finEtiqueta); | |
if (punteroInicio == NULL || punteroFin == NULL) | |
{ | |
printf("No se encontraron las etiquetas"); | |
return; | |
} | |
char cuerpoHtml[TAMANIO_MAXIMO_CONTENIDO] = ""; | |
char contenidoLimpio[TAMANIO_MAXIMO_CONTENIDO] = ""; | |
size_t longitud = punteroFin - punteroInicio; | |
// Copiar el contenido del cuerpo a cuerpoHtml | |
strncpy(cuerpoHtml, punteroInicio, longitud); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment