Re: checking for a blank box?
- From: Michael Hagemann <michael hagemann unibas ch>
- To: gtk-list gnome org
- Subject: Re: checking for a blank box?
- Date: Wed, 05 Mar 2003 10:58:59 +0100
On Tue, 04 Mar 2003 20:37:53 -0500 Brandon wrote:
> What value do I compare the output of gtk_editable_get_text() with in
> order to know if the entry box I'm getting text from is empty or not?
> I'm using an if statement and have tried to do If
> (gtk_editable_get_text(entry,0,-1) == NULL) and it won't make the match
> even when I don't input anything into the entry box. I've also tried
> comparing to '\0' and 32 (ascii value for a space) and nothing ever
> matches. how do i check if a user has inputted anything?
The function (actually gtk_editable_get_chars?!) returns a pointer to
a string. You should be using strncmp along the lines of:
w_text = gtk_editable_get_text(entry,0,-1);
if (strncmp("", w_text, 1))
{
...
}
g_free(w_text);
hth,
michael
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]