Re: Gscanner: can I get the text of scanned floating point numbers
- From: Tim Janik <timj gtk org>
- To: Laurent Lemaitre <laurent lemaitre mot com>
- Cc: GNOME MList <gnome-list gnome org>
- Subject: Re: Gscanner: can I get the text of scanned floating point numbers
- Date: Thu, 3 May 2001 00:44:30 +0200 (CEST)
On Wed, 2 May 2001, Laurent Lemaitre wrote:
> Tim,
>
> I am currently using the Lexical Scanner from glib
> for my application (the appl converts files written
> in verilog to xml).
>
> My problem: my scanner scans floating point numbers (for
> instance 1.22222e-24). It returns G_TOKEN_FLOAT when a
> floating point number is found. I would like to save the
> text that has been scanned (and that served to create the
> value of scanner->value.v_float). Is-there a way to have
> access to the scanned text?
nope you can't i'm sorry.
that level of detail is abstracted by gscanner.
>
> Thanks,
>
> Laurent
>
> PS: with the automatic conversion str->float I can loose
> precision (that is bad for my application :-( )
> More specifically here is what I am doing to get the text back:
> txt = g_strdup_printf ("%e",scanner->value.v_float);
you can however use precision specifiers here (man printf) to
preserve all of the float precision (though, under some circumstances,
those float strings can get quite long),
>
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]