C GTK文本框编号输入
我正在尝试在GTK+3.0中创建一个文本框(在Linux中使用C),它可以作为一个double读取,这个double将被插入到一个等式中,然后返回到另一个框中 所以我的问题是:创建可以输入的文本框的最佳方法是什么,然后如何将其作为双精度文本阅读 我目前正在尝试使用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\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.