[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: programming

* J.A.Serralheiro <mrserra@ci.uc.pt> [2001.11.04 15:26:04+0000]:
> hi. Im trying to read a complete line from a text file. I use the
> fscanf( file, "[^\n]",buffer);  butit doesnt work. I reads the
> entire file until overflow of the buffer.

this is C? well, it doesn't know regexps by default. you fscanf line
would have to be

  fscanf(file, "%s\n", buffer);

to get the desired effect, but this is prone to buffer overflows.
instead, you shoud be using fgets(3).

martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:"; net@madduck
dazed and confused, but trying to continue.

Attachment: pgpkT_5MUq8QC.pgp
Description: PGP signature

Reply to: