Skip to content

Instantly share code, notes, and snippets.

@AstDerek
Created November 8, 2012 08:10
Show Gist options
  • Save AstDerek/4037487 to your computer and use it in GitHub Desktop.
Save AstDerek/4037487 to your computer and use it in GitHub Desktop.
Agregar nueva línea
void agregar_nueva_linea () {
segmento *ultimo_segmento;
char linea[ANCHO_LINEA];
int continuar = 1;
while (continuar) {
fgets(linea,ANCHO_LINEA,stdin)
/* Si hay una nueva línea, es que acabamos de procesar el texto */
if (linea[strlen(linea) - 1] == '\n') {
linea[strlen(linea) - 1] = 0;
continuar = 0;
}
ultimo_segmento = agregar_nodo();
ultimo_segmento->caracteres = strlen(linea);
memcpy(ultimo_segmento->linea,linea,ultimo_segmento->caracteres);
}
mostrar_archivo();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment