3 ms·
How do you join three float values into a comma separated string, and then split it again?
by brainzap 7y ago
How do you join three float values into a comma separated string, and then split it again?
- emilfihlman 7y agoNot sure what you mean but would s8 buf[enoughspace]; snprintf(buf, sizeof(buf), "%f,%f,%f", your, three, values); sscanf(buf, "%f,%f,%f", &your, &three, &values); Do the job?
- KMag 7y agoI think that the GP was making a commentary on the sorry state of locale handling in C. You need to first store the current locale, change the locale to one that doesn't use a comma as the decimal point, perform the above, and set the locale back. Plus, there's no threadsafe way to do this, since the locale is process-wide.