Re: How to avoid the presence of new line in GtkEntry at the end of input string
- From: "Lucky B.C" <lblackc13 gmail com>
- To: arkkimede <arkkimede gmail com>
- Cc: gtk-app-devel-list list <gtk-app-devel-list gnome org>
- Subject: Re: How to avoid the presence of new line in GtkEntry at the end of input string
- Date: Thu, 12 Apr 2018 15:23:41 +0700
Well, GtkEntry (Gtk+-3.0) accesses any UTF input included escapes in your
case is a new line. Sometime the string has a new line at the end that you
maybe copied from somewhere, you should catch the new line code (0x0A - 1
byte), and set the index of the new line is '\0'.
unsigned int length;
length = strlen (the_string);
for (int i = length - 1; i >= 0; i--)
if (the_string [i] == 0x0A)
the_string [i] = '\0';
On Thu, Apr 5, 2018 at 9:53 PM, arkkimede <arkkimede gmail com> wrote:
Hi!
In my GTK3 applications, there are some GtkEntry used to input strings
like, e.g., the output directory.
I write a string in the Entry and using the function gtk_entry_get_text() i
read the string insert in the GUI.
Printing on screen this string, <<some times>> a "new line" is present at
the end of the string (obviously I do not put a new line at the end).
How can avoid this issue?
I have to change function or make some operations before the reading?
Thank You.
Daniele
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]