Created
November 8, 2012 08:10
-
-
Save AstDerek/4037487 to your computer and use it in GitHub Desktop.
Agregar nueva línea
This file contains hidden or 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
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