Re: How to avoid the presence of new line in GtkEntry at the end of input string

2018-04-12 Thread Lucky B.C
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  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, <> 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
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to avoid the presence of new line in GtkEntry at the end of input string

2018-04-05 Thread Bas Wassink


On 04/05/18 21:32, Karan Ahuja wrote:

Hi friend

You could use g_str_split ?

Cheers,
Karan



That doesn't help, that's working around the issue.


On Thu, 5 Apr 2018 20:23 arkkimede,  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, <> 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


I've personally never encountered a newline while using 
gtk_entry_get_text(), perhaps the code you use to display the result 
adds a newline?


Perhaps you could post the offending code, if it isn't too large?

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to avoid the presence of new line in GtkEntry at the end of input string

2018-04-05 Thread Karan Ahuja
Hi friend

You could use g_str_split ?

Cheers,
Karan


On Thu, 5 Apr 2018 20:23 arkkimede,  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, <> 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
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list