Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Jun 2005 01:35:21 -0400
From:      Pablo Mora <fbsd.hackers@gmail.com>
To:        Victor Balada Diaz <victor@bsdes.net>, freebsd-hackers@freebsd.org
Subject:   Re: help me with C languaje please, re: files.
Message-ID:  <a9e342b50506042235372e2519@mail.gmail.com>
In-Reply-To: <20050604181730.GB49520@pato.euesrg02.net>
References:  <a9e342b505060411114e0fe3fd@mail.gmail.com> <20050604181730.GB49520@pato.euesrg02.net>

next in thread | previous in thread | raw e-mail | index | archive | help
#include <stdio.h>
#include <stdlib.h>

int main(void) {

 FILE *p_to_f;
 char buf[1024];
 int i, j =3D 0;

 p_to_f =3D fopen("test","r");

 if(p_to_f =3D=3D NULL) {
  perror("fopen");
  exit(EXIT_FAILURE);
 }

 for(i =3D 0; i < 4 && !feof(p_to_f); i++) {
  fgets(buf,1024,p_to_f);
  printf("%s", buf);
 }

 fclose(p_to_f);

 return 0;

}

I expect that be well what I did.  Thanks Victor.

PD Corrigeme Si hay algo malo. :D

--=20
Concepci=F3n, Chile.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a9e342b50506042235372e2519>