|
johnstonsk wrote:
I run the debugger on the memcpy() function it reads that the function is undefined.
What do you mean it is undefined?? If it compiled then it is defined... You mean that the debugger will not step into the memcpy() function? If so you do not have the correct symbols installed..
John
|
|
|
|
|
johnstonsk wrote:
How can I copy a 2dim array?
CIS101 [Introduction to Computer Science]
|
|
|
|
|
Just wanted to extend to all members a hello and to let you know that I am working with MS VC++ 6.0. I have written a database application for my wife's orchid hobby in MS BV 6.0 and hope to duplicate that effort - as I said, I'm new to c++ and to this board. Hello, and I'm looking forward to learning from all of you. Until I'm more comfortable - I will lurk...;)
Paul
|
|
|
|
|
|
Ryan Binns wrote:
we're a pretty nice bunch of people usually
Yes, as long as you don't ask Programming questions in the Lounge or submit an article that it looks like a four year old wrote you should be ok...
John
|
|
|
|
|
John M. Drescher wrote:
Yes, as long as you don't ask Programming questions in the Lounge or submit an article that it looks like a four year old wrote you should be ok...
Exactly
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
|
Paul Southwick wrote:
in MS BV 6.0
That's the new MS Bisual Vasic programming language that just came out, right?
Seriously though, welcome to CP !
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
|
|
|
|
|
I have a number a different arrays.
double t1[10];
char t2[10];
...
double cpT1[10];
char cpT2[10];
If I make a array of the same size to copy into can I use the memcpy() function like this?
memcpy(cpT1, t1, sizeof(t1));
memcpy(cpT2, t2, sizeof(t2));
Or should I create a function that I pass the amount to the memcpy() function?
If So how can I make it so that I can pass any array to the function?
Thanks,
steven
|
|
|
|
|
If the array are statically created (like in your example), that will work, otherwise not !
|
|
|
|
|
|
memcpy(cpT1, t1, sizeof(t1));
memcpy(cpT2, t2, sizeof(t2));
This will work fine.
John
|
|
|
|
|
|
Hi all
Can i get some way to retrieving pointer on member function of my class i.e. make like this
<br />
class A{<br />
void Fun(){<br />
void *pF = &this->Fun;<br />
}<br />
}<br />
By compiled this snippet, compiler complain:
illegal operation on bound member function expression
Whether exit way what i can do it???
Thanks
Sorry for bad eanglish
|
|
|
|
|
Do you mean, 'how can I get something which represents the combination of an object and a member function'?
You can do this with the STL using the mem_fun_t template. The language itself does not permit such an operation. The expression this->Fun is considered to be a bound member function - the only thing you can do with such an expression is to use the () operator on it (i.e., call it).
|
|
|
|
|
Thanks for advice but whats a reason which prevent do this???
|
|
|
|
|
You can do this, but the syntax is slightly different:
void (A::*pF)() = A::Fun; You will have to call the function in the context of an object:
A obj;
(pobj.*pF)();
A *pobj = new A;
(pobj->*pF)(); Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi
I apparently cant properly realise you because of code dont
wont work by me.
Please see this code and ask where i wrong :
class A{
void Fun(){}
void CallFun(){
void (A::*pF) () = A::Fun;
}
}
//Linker show error:
error C2440: 'initializing' : cannot convert from 'int' to 'void (__thiscall A::*)(void)'
There are no conversions from integral values to pointer-to-member values
Thanks
|
|
|
|
|
Hi
I apparently cant properly realise you because of code dont
wont work by me.
Please see this code and say where i wrong :
class A{
void Fun(){}
void CallFun(){
void (A::*pF) () = A::Fun;
}
}
//Linker show error:
error C2440: 'initializing' : cannot convert from 'int' to 'void (__thiscall A::*)(void)'
There are no conversions from integral values to pointer-to-member values
Thanks
|
|
|
|
|
Strange... Your code compiled perfectly with my compiler, and so did the code I provided. Instead of assigning A::Fun you can try using just Fun , but it should work anyway.
What version of VC are you using?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
OOps
Excuse this warm make me completly dump
I forget set semicolon after class brace!!!
Now all fine.
Very thanks.
|
|
|
|
|
|
lol, what joky answers here...
define the member function static and there shouldn't be a problem anymore
Don't try it, just do it!
|
|
|
|
|
I think we were all assuming that the original poster needed the function to be a member function ('instance method' in C# terminology).
A static member function has no this pointer, of course.
OK, you can do hacks like passing a pointer to the object into the static member function as a parameter, but that doesn't really gain you anything. I only ever do this when creating a thread or writing a callback function for interfacing with a C API - this type of function usually gives you a void* or LPARAM parameter which you can pass arbitrary data in, which gets passed to your thread entry point or callback function.
|
|
|
|
|
Does anyone have the MFC equivalent of
directory.exists()?
|
|
|
|