I've came up with this:
FILE *fd;
char buf[100];
char fmt[10];
/* open fd */
sprintf(fmt, "%%%ds", sizeof(buf)-1);
while (fscanf(fd, fmt, buf) != EOF)
use_word(strdup (buf));
close(fd);
Is it the best way? What do you think?
Thanks,
Mattia
FILE *fd;
char buf[100];
char fmt[10];
/* open fd */
sprintf(fmt, "%%%ds", sizeof(buf)-1);
while (fscanf(fd, fmt, buf) != EOF)
use_word(strdup (buf));
close(fd);
Is it the best way? What do you think?
Thanks,
Mattia
Comment