User Profile
Collapse
-
Then is there any other way to detect keyboard inputs? For example, some C++ programs can be stopped with the Ctrl+C method. They are implementing some sort of thread to detect the keypress right? -
-
using of POSIX threads
Hi all,
I have some questions regarding the usage of POSIX threads. I would like to ask:
1) Is it possible if in a thread, I were to run a scanf function in order to change the value of a global variable?
2) Do I use scanf or std::cin? And why?
eg.
Code:void *detectKey(void *arg) { int y; scanf("%d",&y); while (y !=
-
-
To Banfa: I have already declared the detectKey function at the very beginning of the mainloop.cpp, right below the include, so that should be a global function right? But I will try what you have suggested. Sorry for getting it wrong, I'm only starting out on C++ recently.
To donbock: I will take a look at <pthread.h> as you suggested. Thanks.Leave a comment:
-
Thx for the reply so far. Here's some info that might help:
I'm running on Ubuntu 9.04.
GCC 4.1.3
G++ 4.1.3
The whole error message is:
error: arguement of type 'void (localnav::Main Loop::)(void*)' does not match 'void* (*)(void*)'
As I am working on ORCA (open source code for robotics), the whole code is too long to be displayed. The code where the error is pointing to is at the pthread_create...Leave a comment:
-
another "does not match ‘void* (*)(void*)’" error
Hi all,
I have encountered the above said error for some time. I have researched for possible solutions and have discovered that the error means that the function that I am calling as a thread is a member function. I have already declared the function as a global function, but yet the error still appears. Can anyone help me out here? The code is below. Thx in advance.
Code:#include <pthread.h> #include
No activity results to display
Show More
Leave a comment: