Re: [gtk-list] Re: Heisenberg was right?
- From: Rouat manu <er viking oleane com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Heisenberg was right?
- Date: Wed, 10 Jun 1998 23:08:40 +0200
Rouat manu wrote:
> (from main:)
>
> char buffer[32];
> sprintf (buffer, "%g", p.w);
> gtk_entry_set_text (GTK_ENTRY (w_entry),buffer);
> sprintf (buffer, "%g", p.l);
> gtk_entry_set_text (GTK_ENTRY (l_entry),buffer);
>
> this works - but the original code was:
>
> gtk_entry_set_text (GTK_ENTRY (w_entry),convert_to_char(p.w));
> gtk_entry_set_text (GTK_ENTRY (l_entry),convert_to_char(p.l));
>
> and:
>
> char *convert_to_char(double data)
> {
> char *c;
> static char buffer[10];
>
> sprintf (buffer, "%g", data);
> if(data==N_A)
> sprintf (buffer, "N/A");
> c=buffer;
> /* printf("buffer:%g\n",data); */
>
> return c;
> }
>
> It's the convert_to_char function which is screwy, obviously.
Note: the problem occurs when data=N_A
>
> Any ideas to implement this differently?
>
> (note: #define N_A 6e66 - bad idea I guess....Is there a reserved
> symbol or number in C to describe infinity or 'No result' or
> anything?)
regards
manu
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]