Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert an integer to a string in GLib?

Tags:

glib

I want to convert an integer value to string in GLib. Is there any macro or function to da that? Or Can i store different data types in the same doubly linked list?

like image 447
Ashwin Avatar asked Mar 19 '10 09:03

Ashwin


People also ask

How do you convert integers to strings?

The easiest way to convert int to String is very simple. Just add to int or Integer an empty string "" and you'll get your int as a String. It happens because adding int and String gives you a new String. That means if you have int x = 5 , just define x + "" and you'll get your new String.

How do you convert int to str PY?

In Python an integer can be converted into a string using the built-in str() function. The str() function takes in any python data type and converts it into a string.


1 Answers

  1. gchar *my_string = g_strdup_printf("%i", my_integer);
  2. Yes, you can store any pointer you want, or even an integer using GINT_TO_POINTER, but how will you know what data type to get back out?
like image 108
ptomato Avatar answered Sep 23 '22 17:09

ptomato