Re: Reading a table
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Fri, 30 Nov 2007 11:57:55 -0500
Bill Reid wrote:
CBFalconer <cbfalconer@xxxxxxxxx> wrote in message
Bill Reid wrote:Sure, something like that might come in handy in some situations,
Roland Pibinger <rpbg123@xxxxxxxxx> wrote in message... snip ...
- whithout static FILE
Possibly, but the idea here is just to read a single file and
then close it right up...
- for arbitrary long lines (no hard-coded maximum line lenght)
Yes, but again the idea here is we KNOW the maximum size> of our
file lines,
However, some people want to copy files without worrying about line
length. With ggets (and fggets) you can handle this with ease, as
in the following:
[1] c:\c\junk>cc -o fcopylns.exe ggets.o junk.c
[1] c:\c\junk>fcopylns <junk.c
#include <stdio.h>
#include <stdlib.h>
#include "ggets.h"
int main(void) {
char *line;
while (0 == ggets(&line)) {
puts(line);
free(line);
}
return 0;
} /* main, fcopylns */
Note the complexity. You can get the source etc. for ggets at:
<http://cbfalconer.home.att.net/download/ggets.zip>
but I actually take a somewhat different tack for parsing out text
"tables" with potentially (unpredictably) HUGE "field" sizes.
Try out ggets. It will handle ANY size line. I deliberately
designed it to replace gets, with the usage simplicity, but no
worry about over-run. It's primary use is in interactive work, but
the efficiency is not bad for general use.
--
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
.
- Follow-Ups:
- Re: Reading a table
- From: Richard Heathfield
- Re: Reading a table
- References:
- Reading a table
- From: Stephen . Schoenberger
- Re: Reading a table
- From: user923005
- Re: Reading a table
- From: Stephen . Schoenberger
- Re: Reading a table
- From: Bill Reid
- Re: Reading a table
- From: Roland Pibinger
- Re: Reading a table
- From: Bill Reid
- Re: Reading a table
- From: CBFalconer
- Re: Reading a table
- From: Bill Reid
- Reading a table
- Prev by Date: Re: is this correct C? (char*)spm += spm->partitionMapLength;
- Next by Date: C/C++ on UNIX Developer required in Woodmead, Johannesburg
- Previous by thread: Re: Reading a table
- Next by thread: Re: Reading a table
- Index(es):
Relevant Pages
|