QPMS
Electromagnetic multiple scattering library and toolkit.
|
Some custom string conversions. More...
#include <stddef.h>
Go to the source code of this file.
Functions | |
size_t | qpms_parse_ndoubles (double *target, size_t n, const char *orig) |
size_t | qpms_parse_doubles (double **target, size_t start_index, const char *orig) |
size_t | qpms_parse_doubles_fromfile (double **target, size_t start_index, const char *filepath) |
Some custom string conversions.
size_t qpms_parse_doubles | ( | double ** | target, |
size_t | start_index, | ||
const char * | orig | ||
) |
Parse doubles from a string.
The doubles can be separated by whitespaces, comma or semicolon. The parsed numbers are saved into an array specified by *target that has been preallocated with malloc() to contain at least start_index members. If start_index is nonzero, the newly parsed numbers are saved to the positions starting from start_index.
If *target is NULL, the function allocates the necessary space.
size_t qpms_parse_doubles_fromfile | ( | double ** | target, |
size_t | start_index, | ||
const char * | filepath | ||
) |
Parse doubles from a file.
The doubles can be separated by whitespaces, comma or semicolon. The parsed numbers are saved into an array specified by *target that has been preallocated with malloc() to contain at least start_index members. If start_index is nonzero, the newly parsed numbers are saved to the positions starting from start_index.
If *target is NULL, the function allocates the necessary space.
If filepath is NULL, "" or "-", read from stdin.
size_t qpms_parse_ndoubles | ( | double * | target, |
size_t | n, | ||
const char * | orig | ||
) |
Parse a given number of doubles from a string.
The doubles can be separated by whitespaces, comma or semicolon.