makhlaghi makhlaghi - 1 year ago 85
C Question

Import ASCII table in C as array

I have a series of data saved as a table in an ASCII file, for example:

1 100 2.345
2 342 8.233
3 65 89.23

I have just returned back to C after a few years of working in Python and wondered isn't there already any library that can do this import? Something like
in Python? For example to output a float or a double array? I remember in the past I had to write a program myself to do this job in C (C99 for example), is there any standard package that will do the import? How about saving the results to an ASCII file? I can write a program myself for both of these but I don't want to repeat what other people have definitely done before me!

Answer Source

I wrote my own library to do this (with the help of the kind people here who answered my questions very promptly), you can see it here. It does the job of turning a table of data (with an unknown number of headers, columns and rows) to a C array that can be used in the program. I would appreciate any suggestions. Thank you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download