examples/driver.cpp File Reference

#include <csv_parser/csv_parser.hpp>

Functions

int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

Example Usage of libcsv_parser++

These are some of the characters you may use in this program

  • DEC is how it would be represented in decimal form (base 10)
  • HEX is how it would be represented in hexadecimal format (base 16)
  • DEC HEX Character Name
  • 0 0x00 null
  • 9 0x09 horizontal tab
  • 10 0x0A line feed, new line
  • 13 0x0D carriage return
  • 27 0x1B escape
  • 32 0x20 space
  • 33 0x21 double quote
  • 39 0x27 single quote
  • 44 0x2C comma
  • 92 0x5C backslash Example Program - showing usage of the csv_parser class
In this example, we include the csv_parser header file as <csv_parser/csv_parser.hpp>

Then we declare the variables we are going to use in the program

  • The name of the input file is "example_input.csv"
  • The field terminator is the comma character
  • The record terminator is the new line character 0x0A
  • The field enclosure character is the double quote.
In this example we will be parsing the document as the fields are optionally enclosed.

The first record in the CSV file will be skipped.

Please view the source code of this file more closely for details.

Todo:
Add more examples using different parsing modes and different enclosure and line terminator characters. Include an example where the filename, field_terminator char, line_terminator char, enclosure_char and other program variables are loaded from a file.
Parameters:
int The number of arguments passed
argv The array of arguements passed to the main function
Returns:
int The status of the program returned to the operating system upon termination.
See also:
csv_parser
Author:
Israel Ekpo <israel.ekpo@israelekpo.com>


Generated on Sun Jun 28 21:19:30 2009 for CSV Parser by  doxygen 1.5.5