User Profile

Collapse

Profile Sidebar

Collapse
fantasticamir
fantasticamir
Last Activity: Nov 2 '08, 04:52 PM
Joined: Apr 16 '07
Location: Paris
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • fantasticamir
    replied to How to get the memory usage using C++
    in C
    well I can't, i am running my program on a server that I have no access to...:-( any more help?
    See more | Go to post

    Leave a comment:


  • fantasticamir
    replied to Socket between two threads
    in C
    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.
    See more | Go to post

    Leave a comment:


  • fantasticamir
    started a topic How to get the memory usage using C++
    in C

    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,

    ...
    See more | Go to post

  • 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...
    See more | Go to post

  • fantasticamir
    replied to how to return a 2-D array
    in C
    Thanks for the replies,

    I guess the RRick solution works for me...

    Thanks,
    See more | Go to post

    Leave a comment:


  • fantasticamir
    started a topic how to return a 2-D array
    in C

    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.
    See more | Go to post

  • fantasticamir
    replied to Is this OK?
    in C
    I just want to do

    test= arg->myfunc(...);

    safely with no memory leakage!...
    See more | Go to post

    Leave a comment:


  • fantasticamir
    replied to Is this OK?
    in C
    so what shall I do?? have any idea?...
    See more | Go to post

    Leave a comment:


  • fantasticamir
    started a topic Is this OK?
    in C

    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(...);
    
    ....
    
    }
    may I do that or not?
    I usually use memcpy...
    See more | Go to post

  • fantasticamir
    replied to callback confusion!
    in C
    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...
    See more | Go to post

    Leave a comment:


  • fantasticamir
    started a topic callback confusion!
    in C

    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){
    ......
    See more | Go to post

  • fantasticamir
    started a topic This pointer qustion!
    in C

    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);
    and it is called in an static method so instead of this what can I put??

    Thanks,

    Amir.
    See more | Go to post

  • fantasticamir
    replied to how to convert decimal number to binary
    in C
    bitset<length> myBinary ((long) <your number>) ;

    cout<<myBinary;
    See more | Go to post

    Leave a comment:


  • fantasticamir
    replied to C++ - Thread - Pointer to function!
    in C
    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
    ...
    See more | Go to post

    Leave a comment:


  • fantasticamir
    replied to C++ - Thread - Pointer to function!
    in C
    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....
    See more | Go to post

    Leave a comment:


  • fantasticamir
    replied to C++ - Thread - Pointer to function!
    in C
    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,
    ...
    See more | Go to post

    Leave a comment:


  • fantasticamir
    replied to C++ - Thread - Pointer to function!
    in C
    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*)'
    See more | Go to post

    Leave a comment:


  • fantasticamir
    replied to C++ - Thread - Pointer to function!
    in C
    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?...
    See more | Go to post

    Leave a comment:


  • fantasticamir
    replied to when to use function pointer
    in C
    http://www.newty.de/fpt/index.html
    http://www.goingware.c om/tips/member-pointers.html

    hope it works for you!
    See more | Go to post

    Leave a comment:


  • fantasticamir
    started a topic C++ - Thread - Pointer to function!
    in C

    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...
    See more | Go to post
No activity results to display
Show More
Working...