-
X lib Mouse Click Error
I'm having an error while compiling this function I found
Code:
void mouseClick(int button){
Display *display = XOpenDisplay(NULL);
XEvent event;
if(display == NULL) {
fprintf(stderr, "Error en la apertura del display \n");
exit(EXIT_FAILURE);
}
memset(&event, 0×00, sizeof(event)); -> 1º Error here
event.type = ButtonPress;
event.xbutton.button = button;
event.xbutton.same_screen = True;
XQueryPointer(display, RootWindow(display, DefaultScreen(display)), &event.xbutton.root,
&event.xbutton.window, &event.xbutton.x_root, &event.xbutton.y_root, &event.xbutton.x,
&event.xbutton.y, &event.xbutton.state);
event.xbutton.subwindow = event.xbutton.window;
while(event.xbutton.subwindow){
event.xbutton.window = event.xbutton.subwindow;
XQueryPointer(display, event.xbutton.window, &event.xbutton.root, &event.xbutton.subwindow,
&event.xbutton.x_root, &event.xbutton.y_root, &event.xbutton.x,
&event.xbutton.y, &event.xbutton.state);
}
if(XSendEvent(display, PointerWindow, True, 0xfff, &event) == 0){
fprintf(stderr, "Error al enviar el evento \n");
}
XFlush(display);
usleep(100000);
event.type = ButtonRelease;
event.xbutton.state = 0×100; -> 2º Error Here
if(XSendEvent(display, PointerWindow, True, 0xfff, &event) == 0){
fprintf(stderr, "Error al enviar el evento \n");
}
XFlush(display);
XCloseDisplay(display);
}
1º Error
keyfunc.c:33: error: ‘\303’ parasite in the program
keyfunc.c:33: error: ‘\227’parasite in the program
keyfunc.c:33: error: expected ‘)’ before numeric constant
keyfunc.c:33: error: faltan argumentos para la función ‘memset’
2º Error
keyfunc.c:55: error: ‘\303’ parasite in the program
keyfunc.c:55: error: ‘\227’ parasite in the program
keyfunc.c:55: error: expected ‘;’ before numeric constant
Any help?
I think it is because of the 0×00..
Thanks in advice
-
It looks like you're using a multiplication sign instead of the letter x. Since you say you found the function, whoever uploaded it probably did it via some method that stupidly converts an x in between two numbers to a multiplication sign.
You can probably just change that × to an x (one that you just type on the keyboard) in your editor and it should work. Unless it's your editor doing the changes, in which case you'll have to figure out how to disable that.
-
Lol, how didn't I realize that xD
I'm also getting this error in another function
keyfunc.c:69: error: expected ‘;’ before ‘{’ token
Code:
void NKeyPress(char keyn){
-
Without seeing any context at all, my best guess is that the previous function isn't closed yet, and you can't define a new function inside another one.
-
-
The code you have pasted to pastebin does not give the error you say it does (although it does mention two mistyped switches and the lack of a function usleep).
-
lol, thanks, silly mistakes
-
I didn't wanted to create another post, for this, I think it has to be a little problem..
Code:
char sameWord(char *tolook, char *word){
char lenght, seclenght, i,j;
char buff[7][7];
char secbuff[7][7];
lenght = strlen(word);
for(i=0;i<lenght;i++){
buff[i] = word[i]; -> First Error (line 30)
for(j=0;j<lenght;j++){
if(word[j] == word[i]){
buff[i][i]++;
}
}
}
seclenght = strlen(tolook);
for(i=0;i<lenght;i++){
secbuff[i] = tolook[i]; -> Second error (line 39)
for(j=0;j<lenght;j++){
if(tolook[j] == tolook[i]){
secbuff[i][i]++;
}
}
}
j=0;
for(i=0;i<lenght;i++){
if(buff[i][i] <= secbuff[i][i]) {
j++;
}
}
if(j==lenght) {
return 1;
}
else {
return 0;
}
}
I'm getting this error
keyfunc.c:30: error: incompatible types in the allocation
keyfunc.c:39: error: incompatible types in the allocation
Thanks in advance
-
You can't assign to entire arrays. If you want to copy a string, use the string copy function strcpy.