Skip to content

Latest commit

 

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simpcsv

SimpCSV is a simple and lightweight CSV parsing library designed for random access, written in C.

This library does not check if:

  • The CSV file exists.
  • The CSV file is properly formatted.
  • You have enough memory to parse the CSV file.

Any segmentation faults that occur are probably the result of the above.

Example

#include <stdio.h>
#include "simpcsv.h"

int main(void)
{
    SimpCSVHandle* handle = simpcsv_open_file("test.csv", '"', ',', '\n');

    simpcsv_count_rows_and_cols(handle);

    for (size_t ri = 0; ri < handle->m_number_of_rows; ri++)
    {
        for (size_t ci = 0; ci < handle->m_number_of_cols; ci++)
        {
        // do something...
        }
    }

    simpcsv_close_file(handle);

    return 0;
}

Usage

To use the library, add the header and source file into your repository, and adjust your build configuration accordingly.

Docs

Every single function is annotated with comments in both the header file and the source file.

The comments in the header file contain a quick brief of what each function does. The comments in the source file contain more detailed documentation of the function's parameters and return value.

The quick example at the top under "Example" also shows you the general layout of a program using SimpCSV and how to iterate through all the cells in a CSV file.

Compatibility

Currently, this project has been developed and tested on Linux (Arch) machines only.

Contributing

Feel free to contribute to the project and improve it. There are no strict rules regarding contribution.

License

The project is available under the MIT license.

Copyright (C) David Filiks

About

A random access CSV parsing library in C

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Used by

Contributors

Languages