ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
So, show us what you've written so far, and perhaps someone can offer some suggestions to help fix it. For parsing CSV data, you are going to need to make heavy use of string processing functions. strtok() is one that is probably useful, although it can be tripped up by commas embedded in quoted fields. It is almost impossible to suggest a general solution, unless someone knows of a canned library or source package for parsing such files, and it seems likely that such a package exists. I assume that you have a good reason for choosing a C implementation, rather than something like Perl, which makes such tasks almost trivial.
I don't see how paulsm4's code works for CSV files, either. It would seem to work fine for whitespace separated values. His point that C is the wrong tool for the job should be well taken however. My solution would probably involve something like Perl and the Text::CSV::Simple module. Since you haven't shown any actual data, nor have you given any indication how you wish to process the data, it is impossible to provide anything like a working example.