-2

I have CSV files that contain 2 columns of x and y coordinates, that are the positions of particles.

I want to read these files and be able to use the data inside to calculate a function (I mean I want use the coordinates to calculate the pair distribution function g(r)).

I have the algorithm to calculate this function but I need help with how to access the CSV files, and be able to read and use the data inside. I'm new to programing in C, can anyone help?

unwind
  • 391,730
  • 64
  • 469
  • 606
  • Are those coordinates in integer or float format? Can you copy and paste a couple of lines? It's very easy to read a CSV file but need to know if its integer or float data. See fscanf which allows you to read formatted data from a stream/file. – ja_mesa Jun 13 '13 at 12:18
  • float format 258.80435 463.3913 397.07144 437.17346 299.2073 463.42682 387.05814 456.94186 299.2073 463.42682 316.56976 446.77905 399.61627 456.61627 – Sarah Al-Jawhari Jun 13 '13 at 12:20

1 Answers1

4

You use a library, such as libcsv.

unwind
  • 391,730
  • 64
  • 469
  • 606