1 | initial version |
Yes, you can use libcsv library to exclusively read the initial row by following these steps:
Example:
FILE* file = fopen("example.csv", "r");
csv_t *csv = csv_init(0);
csv_init_io(csv, file);
Example:
csv_read(csv); //Read the first row
Example:
csv_fini(csv, NULL, NULL, NULL);
fclose(file);
Note: The "csvinit" function initializes the CSV parser and the "csvinitio" function associates the parser with a file or a stream. The "csvread" function reads the next record from the CSV stream, and the "csv_fini" function frees the memory allocated by the parser.
By using the above steps, you can read the initial row exclusively and discard the remaining rows.