|
i feel this API <GetExtendedTcpTable> will work for me.If any body has another solution please let me know
Sunit
never say die
|
|
|
|
|
|
Thanx a lot
never say die
|
|
|
|
|
Hi!
I've two unrelated classes named "character" and "test". I've defined a variable "flag" inside test. I've to access this variable from the other class(i.e from "character"). For this I've declared the class "character" as friend in test.h in the private section.
i.e
friend class AICharacter;
and I've also forward declared the class test in character like this:
class test;
I've used the following code to access the variable:
test friend_test = new test();
friend_test->char_flag1 = false;
But it shows the following errors:
(i)error C2079: 'friend_TestAI' uses undefined class 'TestAI'
(ii)error C2512: 'TestAI' : no appropriate default constructor available
(iii) left of '->char_flag1' must point to class/struct/union/generic type
Is there any other way to access a variable which is declared inside some other class?
|
|
|
|
|
Code missing in your post.
I don't see any TestAI class in posted code.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Sorry. It's advised by my organisation not to post original code. Here is the modified post:
Hi!
I've two unrelated classes named "character" and "test". I've defined a variable "flag" inside test. I've to access this variable from the other class(i.e from "character"). For this I've declared the class "character" as friend in test.h in the private section.
i.e
<pre>friend class character;</pre>
and I've also forward declared the class test in character like this:
<pre>class test;</pre>
I've used the following code to access the variable:
<pre> test friend_test = new test();
friend_test->char_flag1 = false;</pre>
But it shows the following errors:
(i)error C2079: 'friend_test' uses undefined class 'test'
(ii)error C2512: 'test' : no appropriate default constructor available
(iii) left of '->char_flag1' must point to class/struct/union/generic type
Is there any other way to access a variable which is declared inside some other class?
|
|
|
|
|
It looks like you simply didn't include the 'test' header file. Forward declarations aren't enough when you need an instance of the object.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I've included "test.h" also in character.h. Now it shows the following errors:
error C2440: 'initializing' : cannot convert from 'test *' to 'test'
No constructor could take the source type, or constructor overload resolution was ambiguous
.\character.cpp(124) : error C2819: type 'test' does not have an overloaded member 'operator ->'
d:\backupdelta3d\charactercontrol\test.h(40) : see declaration of 'test'
did you intend to use '.' instead?
.\character.cpp(124) : error C2232: '->test::char_flag1' : left operand has 'class' type, use '.'
Build log was saved at "file://d:\BackupDelta3D\AICharacterControl\Release\BuildLog.htm"
CharacterAnimation - 3 error(s), 0 warning(s)
Shall I use extern instead of friend? Which is good?
|
|
|
|
|
T.RATHA KRISHNAN wrote: error C2440: 'initializing' : cannot convert from 'test *' to 'test'
Well, the compiler is (of course) right, change the wrong lines (I earlier overlooked the mistake)
test friend_test = new test();
friend_test->char_flag1 = false;
to
test friend_test;
friend_test.char_flag1 = false;
or to
test * pfriend_test = new test();
pfriend_test->char_flag1 = false;
delete pfriend_test;
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
OK.Thank u. What is ur opinion on using extern inplace of friend keyword?
|
|
|
|
|
T.RATHA KRISHNAN wrote: OK.Thank u.
You're welcome.
T.RATHA KRISHNAN wrote: What is ur opinion on using extern inplace of friend keyword?
They are unrelated.
BTW: I would use an accessor methods (get/set ) for exposing the variable.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
T.RATHA KRISHNAN wrote: It's advised by my organisation not to post original code.
Nothing wrong with that. Just make sure your code and comments match, regardless of what names you use.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all
How to get USb Attached Device Size.
modified on Thursday, July 31, 2008 6:20 AM
|
|
|
|
|
Use this.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I *knew* I should have refreshed the page before answering. Great minds think alike, eh?
Iain.
|
|
|
|
|
Iain Clarke wrote: Great minds think alike, eh?
I suppose.
[added]
BTW: maybe some physics exposure lead to such bents.
[/addes]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
I assume you mean disk space? If so use the IOCTL_DISK_GET_LENGTH_INFO control code with DeviceIoControl() .
The documentation can be found here
Hope this helps,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Sorry i was wrong i just edit the question..
|
|
|
|
|
Between my first answer and now, I've had a bit of a look for an answer for you.
First - click on my name to go to an article I wrote about detecting drives being added / removed. It may be helpful for you.
You've already been told about DEVICE_IO_CONTROL possible solution.
The only other function I've found is GetDiskFreeSpaceEx - which doesn't tell you the total size, just the free space.
But if free space is good enough information for you, it will be a lot easier to use.
Good luck,
Iain.
|
|
|
|
|
it is nice but not use full for me..If it is possibel then can you give me example of USB attached device Size..
Thx's
|
|
|
|
|
|
I have almost zero database experience, so please be gentle.
I want to access/update a MS SQL Server (or the free Express version) database from a C++ application (could be MFC if required), but don't know where to start. Any pointers would be very welcome!
Thanks.
|
|
|
|
|
If I remember rightly there is on OLE/DB provider COM object available for MS SQL Server. It should be a matter of writing a COM client to talk to it. I guess OLE/DB is out of date these days but other than going LINQ I don't know what's replaced it.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Digging some more it seems ADO is the way to go. Alternatively I buy a copy of this[^] which will give us support for lots of different databases and is cross-platform, which would be useful for this particular project...
|
|
|
|