ObjectARX

Reply
Active Member
ZibiK
Posts: 10
Registered: ‎06-08-2011
Message 1 of 3 (523 Views)

resbuf* and acedGetVar

523 Views, 2 Replies
06-20-2011 03:03 AM

Hello,

 

could someone explain me why I have error in my sample code?:

 

struct resbuf* Wskaznik;

int OldOsnap = acedGetVar(_T("OSMODE"), &Wskaznik); // here is error

acutRelRb(Wskaznik);

 

Error 1 error C2664: 'acedGetVar' : cannot convert parameter 2 from 'resbuf **' to 'resbuf *'

 

I want to get system variable "OSMODE" and use it in other place in my code.

I declare OldOsnap: public: int OldOsnap;

 

Where I can found a good examples to use "resbuf"?

 

regards,

ZibiK

Employee
artc2
Posts: 205
Registered: ‎06-08-2010
Message 2 of 3 (518 Views)

Re: resbuf* and acedGetVar

06-20-2011 10:43 AM in reply to: ZibiK

The docs for acedGetVar() very clearly state that the second argument must be a pointer to an allocated resbuf.  In your code you are passing in the address of a pointer to resbuf.  You need to change:

 

struct resbuf* Wskaznik;

 

to this:

 

struct resbuf Wskaznik;

 

and get rid of the acutRelRb() call since your resbuf is now on the stack and will be freed automatically when it goes out of scope.

Active Member
ZibiK
Posts: 10
Registered: ‎06-08-2011
Message 3 of 3 (509 Views)

Re: resbuf* and acedGetVar

06-21-2011 12:00 AM in reply to: artc2

Thank's you artc2 for your help :smileywink:

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.