-
-
Save parzibyte/03557e78f7257aadb1831e9c00c1ce44 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
void cargarArchivoEnMemoria() { | |
FILE *archivoOriginal; | |
int tamanioBuffer = MAXIMA_LONGITUD_LINEA; | |
char linea[tamanioBuffer]; | |
archivoOriginal = fopen(nombreArchivoOriginal, "r"); | |
if (archivoOriginal == NULL) { | |
printf("Imposible leer el archivo %s", nombreArchivoOriginal); | |
exit(EXIT_FAILURE); | |
} | |
while (fgets(linea, tamanioBuffer, archivoOriginal)) { | |
size_t longitudLinea = strlen(linea); | |
// Checar si la línea no es un salto de línea vacío | |
if (longitudLinea > 1) { | |
// De la línea, removemos el salto de línea | |
strtok(linea, "\n"); | |
agregarLineaALista(linea); | |
} | |
} | |
fclose(archivoOriginal); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment