|
A forward reference tells the compiler about a type (usually a class/struct) without giving the full definition. Its purpose is similar to a function prototype in that regard.
You most often use them when two classes have to refer to each other.
class Bar;
class Foo
{
Bar* m_pBar;
};
class Bar
{
Foo m_foo;
};
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
You cannot truly appreciate Dilbert unless you've read it in the original Klingon.
|
|
|
|
|
I kinda figured it was like a function prototype, but I wasn't sure...
Thanks for clearing that up for me
Cheers
How do I print my voice mail?
|
|
|
|
|
a class that has been declared but not been defined,the class is been called forward referenced.
|
|
|
|
|
I am trying to determin wether a point with certain koordinates is inside a circle determined by other 3 pointes.
I calculated the radius of the circel and the coordinates of its middle point
I now want to put the coordinates of the point I am examining into the circles equation to see wether its inside the circle or outside but becuse of inaccurate calculations (sqrt function etc.) I always get a very big error my calculations are correct as far as I can determine, how can I bypass this problem:
bool HszogTeszt (Pont a, Pont b, Pont c)
{
double hossz1qvd = Distanzqvd(a[0], a[1], b[0], b[1]);
double hossz2qvd = Distanzqvd(a[0], a[1] ,c[0], c[1]);
double hossz3qvd = Distanzqvd(c[0], c[1], b[0], b[1]);
double hossz1 = sqrt(hossz1qvd);
double hossz2 = sqrt(hossz2qvd);
double hossz3 = sqrt(hossz3qvd);
if (hossz1>= (hossz2+hossz3)) return false;
if (hossz2>= (hossz2qvd);
double hossz3 = sqrt(hossz3qvd);
if (hossz1>= (hossz2+hossz3)) return false;
if (hossz2>= (hossz1+hossz3)) return false;
if (hossz3>= (hossz2+hossz1)) return false;
double radiusqvd;
double s;
s = (hossz1 + hossz2 + hossz3)/2;
radiusqvd = (hossz1qvd*hossz2qvd*hossz3qvd)/(16*(s*(s-hossz1)*(s-hossz2)*(s-hossz3)));
double kx, ky;
ky = ((c[0]*c[0]-b[0]*b[0]+c[1]*c[1]-b[1]*b[1])*(c[0]-a[0])/2-(c[0]*c[0]-a[0]*a[0]+c[1]*c[1]-a[1]*a[1])*(c[0]-b[0])/2)/((c[1]-b[1])*(c[0]-a[0])-(c[1]-a[1])*(c[0]-b[0]));
kx = ((c[0]*c[0]-b[0]*b[0]+c[1]*c[1]-b[1]*b[1])/2-ky*(c[1]-b[1]))/(c[0]-b[0]);
int dpszamol;
{
double aux;
aux = ((FelszinPontok.PontHalmaz[dpszamol][0] - kx)*(FelszinPontok.PontHalmaz[dpszamol][0] - kx) +
(FelszinPontok.PontHalmaz[dpszamol][1] - ky)*(FelszinPontok.PontHalmaz[dpszamol][1] - ky) - radiusqvd);
if (aux<-1) return false;
}
return true;
}
Muad-Dib
mailto:adamo_piar@freemail.hu
Made in Hungary
|
|
|
|
|
I am using MFC in VC++ v7. I need to do two things:
1. Programmatically give my window focus, and put it over all other windows.
2. Take away my windows focus, but still leave it on top of all other windows. Or, if it is possible, exclude one, and just put my window on top of all others without giving it focus.
Any help would be great.
|
|
|
|
|
One solution is SetWindowPos().
Kuphryn
|
|
|
|
|
|
IHMO if a DLL or EXE is in memory it IS loaded
Secondly...how do you know it's in memory and how did you get it there?
Did you open the exe and copy the entire file into RAM???
Use LoadLibrary()
If after this you still feel the need to load a DLL manually you would probably have to read some of the advanced hooking articles on here...I recall and article that disscussed ways of changing your CPU's IP allowing you to hijack API calls and such, which is probably the direction you want to head in
Cheers
How do I print my voice mail?
|
|
|
|
|
HINSTANCE hinst_yourdll;
BOOL m_bCanDo;
hinst_yourdll = LoadLibrary( "yourneed.dll" );
m_bCanDo= FALSE;
if(hinst_yourdll)
{m_bCanDo = TRUE;
dllfunc_yourneed = ((LPFNDLLFUNC1) GetProcAddress( hinst_yourdll, "yourneedfunc" ));
}}
|
|
|
|
|
Hi !!
Please help me, i have the following problem with "read data from txt"
First of all I have #include <fstream> and there is also : using namespace std;
typedef int Pont[3]; // 3D (x,y,z) co-ordinates
<code>int Pointloader()
{ const int PontNum= 5;
int load[3]= {0};
Pont RendPoints[PontNum];
ifstream my_file("d:\\prog2004\\my_file.txt");
my_file >> (int)load[0] >> (int)load[1]>> ' ' >> (int)load[2] >> ' ' >> '\n';
my_file.close();
}</code>
DEBUG:
error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'const char' (or there is no acceptable conversion)
Muad-Dib
mailto:adamo_piar@freemail.hu
Made in Hungary
|
|
|
|
|
Remove ' ' from this line:
my_file >> (int)load[0] >> (int)load[1]>> ' ' >> (int)load[2] >> ' ' >> '\n';
and change it to:
my_file >> (int)load[0] >> (int)load[1]>> (int)load[2];
Kamyar Souri
Booria CAD/CAM Systems
www.booria.com
|
|
|
|
|
#include<fstream>
#include<iostream>
using namespace std;
void Pointloader()
{ //const int PontNum= 5; //i dont know its use
int data;
int load[3]= {0};
//Pont RendPoints[PontNum];
ifstream my_file("F:\\test\\mytest.txt");
int i=0;
while ( my_file >> data )
{i+=1;
cout<
|
|
|
|
|
Hello,
<br />
while ( my_file >> data )<br />
{i+=1;<br />
cout<<data;<br />
load[i]=data;<br />
} <br />
this won't work when there are more lines of data!
Exemple:
The text file contains two lines of data:
1 23 345
456 5 567
The first two numbers will be read correctly. After you read the third number, i will contain the value 3, which will result in undefined behaviour!!!
if the program is very small, you can be lucky, but this is very and I mean VERY bad programming!!!
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
guys:
there are the folowing data(greater than three lines:
123 23 45
23 56 89
123 345
6564
65757
123 456
the running result:
123 23 45 23 56 89 123 345 6564 65757 123 456 Press any key to continue
|
|
|
|
|
and therefore the running result for the index integer i would become greater than two! since your array isn't dynamic, you'll end up writing to adresses that arn't allocated or even worse, adresses allocated to other variables...
That kind of programming mistakes lead to undefined behaviour...
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Hi All,
What do I need in oreder to store Information from some computers, and later check/use this information in a different files?
mmfried
|
|
|
|
|
Why is the title "Registry"?
Don't try it, just do it!
|
|
|
|
|
If I wasn't clear enough I want to read the registry of other computer (remotl connected) to some computer, collect the reg. info. from that computer, (and then use the info. later).
- I don't want just to copy files, but registry info. from a remote computer.
|
|
|
|
|
|
Hi.
I was wondering of anyone can shed light on how labview (and the like) send the SAME data (maybe a packet from socket or from a hardware card or something) to multiple objects like graphs that wants it? What would be the best way to connect all these together so that memory is best controlled? Or is it that the object who wants certain data looks at a certain memory location. Maybe each object will process data at different rates.
I hope I am explaining it right. Right now, I have threads that read from Sockets with information that needs to be sent to multiple objects. Maybe multiple object will want the same information. The data for the sockets will be coming in fast continuously. It just seems that alloc memory and sending this packet to everyone is not very good. I am also thinking that I will put this in a memory location and then send a message to the object telling it that data is ready. But then how do I let multiple object read the same location and then update it when the last object reads it. Each object may read it at different times.
Thank you for any thoughts.
|
|
|
|
|
It sounds like a classical use for 'publish and subscribe' 'pattern'/method .. you have one publisher broadcasting the data to multiple recievers ie subscribers - I havnt thought about this a lot, because it depends on the size of the incoming 'data packet' - if its quite large, you could use the same pattern, but a pointer to the data in a shared memory region could be published, then each subscriber can read the data from the shared memory with the pointer ...
there are quite a few implemenations of pub/subscribe around, 'Plugware Solutions' I beleive published an article here on CP recently ...
hth
'G'
|
|
|
|
|
All you should do is to synchronize multiple threads to treat your data in a safe manner.
because your data is shared resource between these threads so you must protect it with a Semaphore (an OS synchronization object).
See MSDN->SDK for more details...
Kamyar Souri
Booria CAD/CAM Systems
www.booria.com
|
|
|
|
|
How can I change the relational operator according to user selection?
example:
(can this be simplified?)
<br />
if (nUserCode==1){<br />
if (num1 > num2 &&<br />
num2 > num3 &&<br />
num3 > num4 &&<br />
num4 > num5) DoSomething();<br />
} else<br />
if (nUserCode==2){<br />
if (num1 < num2 &&<br />
num2 < num3 &&<br />
num3 < num4 &&<br />
num4 < num5) DoSomethingElse();<br />
}<br />
|
|
|
|
|
no, i can't see a simplest way to say that the numbers are in order...
or you write a generic function, but that is not the simple way you were looking for.
<font style="color:blue;">if </font>(nUserCode == 1) {
<font style="color:blue;">if </font>((num1 > num2) && (num2 > num3) && (num3 > num4) && (num4 > num5)) {
DoSomething(); <font style="color:green;">
}
<font style="color:blue;">else if </font>(nUserCode == 2) {
<font style="color:blue;">if </font>((num1 < num2) && (num2 < num3) && (num3 < num4) && (num4 < num5)) {
DoSomethingElse(); <font style="color:green;">
}
}
}
TOXCCT >>> GEII power
|
|
|
|
|
What I meant was:
if (nUserCode==1)... use the ">" operator else
if (nUserCode==2)... use the "<" operator
is there any way to substitute the relational operator with a variable?
e.g.
(num1 Variable num2)
when nUserCode==1, the above becomes (num1 > num2). Similarly,
when nUserCode==2, the above becomes (num1 < num2).
|
|
|
|