diff options
Diffstat (limited to 'src/lib/netlist/plib/putil.h')
-rw-r--r-- | src/lib/netlist/plib/putil.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/lib/netlist/plib/putil.h b/src/lib/netlist/plib/putil.h index cca55c732ef..771588831e9 100644 --- a/src/lib/netlist/plib/putil.h +++ b/src/lib/netlist/plib/putil.h @@ -163,12 +163,19 @@ namespace plib if (CLOCALE) { std::stringstream ss; - //ss.imbue(std::locale("C")); ss.imbue(std::locale::classic()); ss << arg; + long int len(ss.tellp()); long double x(0.0); - *idx = (ss >> x) ? static_cast<std::size_t>(ss.tellg()) : 0; - //printf("%s, %f, %ld\n", arg, (double)x, *idx); + long int pos(0); + if (ss >> x) + { + pos = static_cast<long int>(ss.tellg()); + if (pos == -1) + pos = len; + } + *idx = static_cast<std::size_t>(pos); + //printf("%s, %f, %lu %ld\n", arg, (double)x, *idx, (long int) ss.tellg()); return x; } else |