Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C GTK文本框编号输入_C_Linux_Gtk_Special Characters - Fatal编程技术网

C GTK文本框编号输入

C GTK文本框编号输入,c,linux,gtk,special-characters,C,Linux,Gtk,Special Characters,我正在尝试在GTK+3.0中创建一个文本框(在Linux中使用C),它可以作为一个double读取,这个double将被插入到一个等式中,然后返回到另一个框中 所以我的问题是:创建可以输入的文本框的最佳方法是什么,然后如何将其作为双精度文本阅读 我目前正在尝试使用gtk\u entry\u new()进行初始化,并在经过一些中间步骤后,*gtk\u entry\u获取文本进行读取 我的阅读行当前看起来如下所示: double y = (double)*gtk_entry_get_text(GTK

我正在尝试在GTK+3.0中创建一个文本框(在Linux中使用C),它可以作为一个double读取,这个double将被插入到一个等式中,然后返回到另一个框中

所以我的问题是:创建可以输入的文本框的最佳方法是什么,然后如何将其作为双精度文本阅读

我目前正在尝试使用
gtk\u entry\u new()
进行初始化,并在经过一些中间步骤后,
*gtk\u entry\u获取文本
进行读取

我的阅读行当前看起来如下所示:

double y = (double)*gtk_entry_get_text(GTK_ENTRY(input_y));
我一直用y作为指针,
*gtk_entry_get_text(…)
的格式为const gchar*

我认为最好的方法是将常量gchar*转换为双精度
但如何转换?

$manatof

NAME
   atof - convert a string to a double

SYNOPSIS
   #include <stdlib.h>

   double atof(const char *nptr);

DESCRIPTION
   The atof() function converts the initial portion of the string
   pointed to by nptr to double.  The behavior is the same as

       strtod(nptr, (char **) NULL);

   except that atof() does not detect errors.

RETURN VALUE
   The converted value.
$man atof

NAME
   atof - convert a string to a double

SYNOPSIS
   #include <stdlib.h>

   double atof(const char *nptr);

DESCRIPTION
   The atof() function converts the initial portion of the string
   pointed to by nptr to double.  The behavior is the same as

       strtod(nptr, (char **) NULL);

   except that atof() does not detect errors.

RETURN VALUE
   The converted value.