All pastes #1276312 Raw Edit

Miscellany

public c v1 · immutable
#1276312 ·published 2008-12-04 22:29 UTC
rendered paste body
/** *  leo.c *  * @descripcion lee un fichero y vuelca los datos  estructuras del tipo registro  */  #include <stdio.h>/* registro */struct registro{    int edad;    char nombre[60];};int main(){	 int i;    FILE *f;	struct registro r;    /* leemos 3 registros */    f=fopen("registros.dat","r");    	    if (!f)        return 1;    for (i=1;i<=3; i++)    {    	         fread(&r,sizeof(struct registro),1,f);        printf("edad: %d\n",r.edad);        printf("nombre: %s\n",r.nombre);    }    fclose(f);    printf("\n");	return 0;}