Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Problem with XStringListToTextProperty

$
0
0
I am having a problem with this code giving me

Code:

xbuplot.c: In function ‘void xbuinit_(float*, float*)’:
xbuplot.c:213:63: error: invalid conversion from ‘const char**’ to ‘char**’ [-fpermissive]
In file included from xbuplot.c:2:0:
/usr/include/X11/Xutil.h:727:15: error:  initializing argument 1 of ‘int XStringListToTextProperty(char**, int, XTextProperty*)’ [-fpermissive]
xbuplot.c:220:59: error: invalid conversion from ‘const char**’ to ‘char**’ [-fpermissive]
In file included from xbuplot.c:2:0:
/usr/include/X11/Xutil.h:727:15: error:  initializing argument 1 of ‘int XStringListToTextProperty(char**, int, XTextProperty*)’ [-fpermissive]


Code:


  const char* icon_name = "Xbuplot";
  const char* window_name = "Xbuplot";

  if (XStringListToTextProperty (&window_name, 1, &windowName ) == 0) {
    (void) fprintf (stderr, "ERROR: structure allocation for windowName failed.\n");
    exit(-1);
  }

  if (XStringListToTextProperty (&icon_name, 1, &iconName ) == 0) {
    (void) fprintf (stderr, "ERROR: structure allocation for iconName failed.\n");
    exit(-1);
  }

---------- Post updated at 09:50 PM ---------- Previous update was at 08:14 PM ----------

Problem solved using the code below

Code:

  if (XStringListToTextProperty ((char **) &window_name, 1, &windowName ) == 0) {
    (void) fprintf (stderr, "ERROR: structure allocation for windowName failed.\n");
    exit(-1);
  }

  if (XStringListToTextProperty ((char **) icon_name, 1, &iconName ) == 0) {
    (void) fprintf (stderr, "ERROR: structure allocation for iconName failed.\n");
    exit(-1);
  }


Viewing all articles
Browse latest Browse all 16232

Trending Articles