Skip to content

Instantly share code, notes, and snippets.

@parzibyte

parzibyte/leer.c Secret

Created February 2, 2021 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/76938cf3756a40182d02fbf2fbc9d419 to your computer and use it in GitHub Desktop.
Save parzibyte/76938cf3756a40182d02fbf2fbc9d419 to your computer and use it in GitHub Desktop.
FILE *archivo;
unsigned char bufer[TAMANIO_BUFER];
archivo = fopen(nombreArchivo, "r");
if (archivo == NULL)
{
printf("Error abriendo el archivo");
return;
}
// Leer archivo
char contenido[TAMANIO_MAXIMO_CONTENIDO] = "";
while (!feof(archivo))
{
fread(bufer, sizeof(char), sizeof(bufer), archivo);
// Almacenar contenido en el búfer
strcat(contenido, bufer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment