User Profile
Collapse
-
well I can't, i am running my program on a server that I have no access to...:-( any more help? -
have you ever tried? I do not see any problem that you can't. You may use the network socket for sure for this in C++. One of them is listening on a specific port and the other one send messages to that port... as long as you have not both threads listening on same port things should be fine I suppose.Leave a comment:
-
How to get the memory usage using C++
Guys,
I have a program that has some stages. I am looking for a function/method or anything that tell me how much each part of the code (or even specific class) consumes memory.
Please help me out with any type of method by which I can measure the used memory of my code or...
I know top and ps ... I need a some functions, since I need to insert it into my program.
Thanks,
... -
linking problem... file not recognized: File format not recognized
I have a simple program using a couple of classes and it compiled successfully but while it is linking I have the following problem:
g++ -Wall -lcu -lglu ACL2MDD.o Link.o Rule.o reachability.o -o Reachability
Link.o: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make: *** [Reachability] Error 1
Another observation is the Link.o and Rule.o files, both of them... -
Thanks for the replies,
I guess the RRick solution works for me...
Thanks,Leave a comment:
-
how to return a 2-D array
Guys,
I have a private 2-D array and I am wondering how I can have a getArray() function to return it.
private:
string myarr[10][20];
I need the snippet of the code of the getArray() function! I checked all of the ways I know but none works...
Thank you in advance,
Amir. -
I just want to do
test= arg->myfunc(...);
safely with no memory leakage!...Leave a comment:
-
-
Is this OK?
I have a segmentation fault, and I am looking for it!
I am wondering if it is OK to do that:
Code:class A{ public: B* myfunc(...); } void func(A * arg) B* test=new B(); test= arg->myfunc(...); .... }
I usually use memcpy... -
The problem is solved by these changes:
42. EventInterface: :EventInterface (callBackFunc * ptToFunc){
19. callBackFunc* receiveTest;
20. receiveTest->onMessageFunct ion=&myProgramT est::onMess;
55. onMessageFunc= *(callBackFunc* ) arg;
46. if (pthread_create ( &receiveThre ad, NULL, EventInterface: :receiveEvent, (void *) ptToFunc))
54. callBackFunc...Leave a comment:
-
callback confusion!
I am so confused... do you have any idea how I can come over this segmentation fault?
[CODE=cpp]
class myProgramTest : public EventInterface
{
public:
void myMainProg (void);
static void onMess(Event*, int);
private:
static int subscriptionID2 , subscriptionID, subscriptionID1 ;
};
void myProgramTest:: onMess(Event* _event, int subID){
...... -
This pointer qustion!
Guys,
As you know static member functions do not have a this pointer. so instead, what shall i do?
for example ... consider I want to call
Code:pthread_create(&thID,NULL,classA::B, (void *) this);
Thanks,
Amir. -
bitset<length> myBinary ((long) <your number>) ;
cout<<myBinary;Leave a comment:
-
for those who might see this thread then... I finally come up with a syntax which WORKS!
I just wrap my pointer to function in an struct!\
Code:class EventInterface { public: typedef struct{ void (*onMessageFunction)(Event*, int); } callBackFunc; EventInterface(callBackFunc); ... static void * receiveEvent (void
Leave a comment:
-
actually I read that after I post my new post!
The problem is the name of call back function is called from EventInterface constructor. so how could it be possible with your solution?!
maybe I need to read your solution more accurately....Leave a comment:
-
I guess I find a way to solve the problem.
Code:class EventInterface { public: typedef void (*onMessageFunction)(Event*, int); EventInterface(onMessageFunction); } EventInterface::EventInterface(onMessageFunction pt2Func){ pthread_create( &receiveThread, NULL, EventInterface::receiveEvent,
Leave a comment:
-
forexample when I define this like:
pthread_create( &receiveThre ad, NULL, EventInterface: :receiveEvent, (void *) (*ptToFunc))
or
pthread_create( &receiveThre ad, NULL, EventInterface: :receiveEvent, (void *) ptToFunc)
I have this error:
error: invalid conversion from 'void* (*)(void (*)(Event*, int))' to 'void* (*)(void*)'Leave a comment:
-
I am working with linux.
I just have one question: what is the correct syntax to call a method with function pointer as an argument in pthered_create?...Leave a comment:
-
http://www.newty.de/fpt/index.html
http://www.goingware.c om/tips/member-pointers.html
hope it works for you!Leave a comment:
-
C++ - Thread - Pointer to function!
Guys,
I have a problem which takes me 2 days to solve so far, hope you may help me.
I have posted a thread before about it but unfortunately the problem is still there!!
http://www.thescripts.com/forum/thread647482.html
-----
the problem is simply "I do not know what is the correct syntax if I want to call a function in POSIX thread create which has an argument which is pointer...
No activity results to display
Show More
Leave a comment: