Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
xt_ff_dsv_line_read(3)	    Library Functions Manual	  xt_ff_dsv_line_read(3)

NAME
     xt_ff_dsv_line_read() - Read a line of generic tabular data

LIBRARY
     #include <xtend/ff-dsv.h>
     -lxtend

SYNOPSIS
     int     xt_ff_dsv_line_read(xt_ff_dsv_line_t *xt_ff_dsv_line, FILE *stream, const char *delims)

ARGUMENTS
     xt_ff_dsv_line    Pointer to a xt_ff_dsv_line_t structure to hold the fields
     stream	 FILE stream from which the line is read
     delims	 Array of acceptable delimiters

DESCRIPTION
     Read  a line of an arbitrary DSV file into a xt_ff_dsv_line_t object.  Mem-
     ory is allocated for the text of the fields, and it  must	be  freed  using
     fsv_line_free(3)  before  calling xt_ff_dsv_line_read(3) on the same object
     again.

     The xt_ff_dsv_line_t structure contains an array of strings,  each  holding
     one  field  from  the line, and an an array of delimiters, each holding the
     character that ended the corresponding field.  Note that each  field  could
     potentially  end  with a different delimiter, as multiple delimiters can be
     specified.

     This function serves a purpose similar to the split() functions present  in
     many  languages.	However,  it does not need to read an entire line into a
     character array and then split the array.	Instead, it separates fields  as
     they are read from the input stream.

RETURN VALUES
     Actual delimiter of last field (should be newline)

EXAMPLES
     xt_ff_dsv_line_t  *line = xt_ff_dsv_line_new();

     while ( xt_ff_dsv_line_read(line, stdin, "\t") != EOF )
     {
	 xt_ff_dsv_line_write(line, stdout);
	 xt_ff_dsv_line_free(line);
     }

SEE ALSO
     xt_ff_dsv_line_new(3),    xt_ff_dsv_line_free(3),	 xt_ff_dsv_line_read(3),
     xt_ff_dsv_line_write(3),  xt_ff_dsv_line_copy(3),	xt_ff_dsv_read_field(3),
     xt_ff_dsv_read_field_malloc(3),			xt_ff_dsv_skip_field(3),
     xt_ff_dsv_skip_rest_of_line(3)

							  xt_ff_dsv_line_read(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=xt_ff_dsv_line_read&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help