All pastes #29790 Raw Edit

para inw'

public c v1 · immutable
#29790 ·published 2005-11-20 23:06 UTC
rendered paste body
#include<stdio.h>#include<stdlib.h>int main(int argc,char**argv){        FILE*d;        int*linea,lineas,c;        if(!(d=fopen(argv[1],"r"))){                perror("fopen");                fprintf(stderr,"failed to open %s\n",argv[1]);                exit(1);        }        linea=(int*)malloc(sizeof(int));        lineas=1;        while(!feof(d)){                i=getch(d);                if(i=='\n'){                        lineas++;                        linea=(int*)malloc(lineas*sizeof(int));                }                else                        linea[lineas]++;        }        printf("el archivo tiene %i lineas\n",lineas);        return 0;}