RE: [GLIB] Handling float with gscanner



> I'm trying to use gscanner to read float numbers, and it
> works well if I
> use unsigned numbers. But when I try to read a number like -17.0, it
> complains. It seems that it doesn't recognize the sign '-'.
>
> Is it normal?

Here is the relevant paragraph from the article mentioned earlier:

---
If you are wondering why all the integer values are unsigned long, the
answer is simple. GScanner does not look at the number sign when scanning
numbers. So if the input contains
-32 you will get two tokens: one for the minus sign, and one for the integer
32.
---

Hope that helps,
Bill Hayden





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]