I am creating a function that receives and breaks a string into several, depending on the delimiter (s) chosen by the programmer. So I have:
void split(const wchar_t* text, const wchar_t* seps,wchar_t ***str, int *count)
- text: the string to be broken
- seps: the delimiters
- str: string vector (return)
- count: number of broken strings
The function seems to work without any problems and no memory leak . The problem is that when I use the function the text output (in the X11 window), it appears with random colors. I've erased the whole body of the function, but the problem still persists.
The code looks like this:
void split(const wchar_t* text, const wchar_t* seps,wchar_t ***str, int *count){
//nota que o corpo da função está vazio
}
void ShowWindow(const char* title, const wchar_t* text)
{
Display* dpy = NULL;
Window win;
wchar_t** text_splitted;
int textLines;
setlocale(LC_ALL,"");
split(text,L"\n" , &text_splitted, &textLines);
...
}
It's very strange because the function is empty. And when I do not call it, the text appears with the black color, which is normal.
Note: Colors do not appear when compile the code in Ubuntu, but when compile in Debian they appear.