|
Modify the code as follows.
It should serv your purpose.
void main(){
char *a;
char b = 'B';
a = &b;
cout <<"address of a = " <<&a <
|
|
|
|
|
Can you please explain this to me:
(unsigned long)(*(&a))
thanks
|
|
|
|
|
a contains address of b. But if you say cout << a, it won't print the contents of a ( i.e address of b).
But you know it is address i.e. unsigned long type, so force it to print conent of a as an address.
Actually referencing & derefrerncing in the statment is not required.
i.e (unsigned long)(*(&a)) is same as (unsigned long)(a)
|
|
|
|
|
hmmm, yes that makes much more sense, thanks!
|
|
|
|
|
I`m having problem on getting list of tables from ODBC data source. I use SQLTable, but it didn`t work. It think it`s the first parameter. does anybody knows what to pass to the first parameter( h_stmt)? Thank you. I hope this is a good question.
|
|
|
|
|
The first parameter is a SQLHSTMT variable.
SQLHSTMT h_stmt;
I am unaware of any SQLTables examples BUT If you look at the example for SQLColumns[^] does that help?
If not can you post a snippet of the code you are trying to use.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
See here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I tried looking through a few of the articles that were given on the site about using the clipboard, but none of them really made sense to me or helped.
I am trying to make the following call:
frame1 = Clipboard.GetDataObject();
But I keep getting the following error:
error C2065: 'Clipboard' : undeclared identifier
Now I assumed that I had to add an include directive to fix this problem, however, after much searching through the MSDN I wasn't able to come up with anything. Any help with this problem would be very much appreciated.
Micheal
|
|
|
|
|
tunerica wrote:
frame1 = Clipboard.GetDataObject();
Sounds like VB no?
Are you sure this[^] didnt help?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I'm using Visual C++, have I set it up as if I was using VB?
I did look at that article but couldn't really get anything from it.
To explain further what I am trying to do, I have used the function capEditCopy to put a frame from the video buffer to the clipboard. I wanted to assign that data to frame1 which is an IDataObject. If anyone knows a better way to do it, I would be happy to give it a try. But if you tell me what my error is that would be even better.
Micheal
|
|
|
|
|
OleGetClipboard( &frame1 );
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
we developed a point of sale software for desktop, now i want to
convert that in to touch screen enviornment.
Any idea..????
mind is everything.
|
|
|
|
|
Sure why not
I am not trying to be rude but I would think that a more senior member of CP would be able to pose a well formed question.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
sorry...actually my clipboard cheated me.!!!
also i was in a hurry...!!!
mind is everything.
|
|
|
|
|
Make sure you use a touch screen with a driver that emulates a mouse. Then it becomes just a question of being able to press buttons and other controls with fingers. Try it yourself and you will quickly see the issues involved.
__________________________________________
a two cent stamp short of going postal.
|
|
|
|
|
Hi
i am facing problem related to saving the contnt of the view as image in bitmap file.
http://www.codeguru.com/forum/showthread.php?s=&threadid=300550
Help reqd. urgently.
I want my memory device context variable to be member of my CMyView class.
Sandeep
Leave your mark wherever you go
|
|
|
|
|
I have tried to pass a pointer to a function and then with a copy of it's address, allocate a block of memory to it, expecting to be able to use it after the function call.
I know what the workarounds are so please don't just supply me with the function returning an address or allocating the memory before passing the pointer.
What i need is a good explanation of why this can't be done. I'm a bit puzzled because i expected 'new' to be able to use the memory address passed into the function, even if it is a copy.
thanks in advance
#include "<iostream>"
using namespace std;
void ChangeValue(char* p);
main()
{
char* pstr=0;
ChangeValue(pstr);
/*
Why doesn't pstr now point to the first block allocated by new?
If pstr has been passed in by value and a copy of it's memory address was used
by new to identify the starting address to be stored?
This has certainly got to do with scope but i would have thought this would work.
*/
cout<
|
|
|
|
|
This is the way the C and C++ languages work. If you pass a variable into a function, a copy of the variable is passed in, and however you modify the variable inside that function, it will have no effect on the "original" variable.
To achieve what you want to achieve, you could either pass a pointer to a pointer, or a reference to a pointer (the second is easier to "get your head around", as a rule.
As a pointer to a pointer
ChangeValue(&pstr); // pass in the address of the pointer, not the pointer itself
and
void ChangeValue(char** p)<br />
{<br />
cout <<"about to allocate";<br />
<br />
*p = new char[50]; <br />
strcpy(*p,"Test String");<br />
<br />
}
As a reference to a pointer
ChangeValue(pstr); // note, no change to your original code
and
void ChangeValue(char*& p)<br />
{<br />
cout <<"about to allocate";<br />
<br />
p = new char[50]; <br />
strcpy(p,"Test String");<br />
<br />
}
|
|
|
|
|
thankyou for the response Graham, however i'm still a little puzzled.
When i pass a pointer into a function, even though a copy is made, i am
confident of being able to modify the 'Actual' variable the pointer points too. (after dereferencing it) Why doesn't pstr also point to the newly allocated mem? Is not p a copy of pstr's address?
|
|
|
|
|
randallcarl@hotmail.com wrote:
i am
confident of being able to modify the 'Actual' variable the pointer points too
You're quite right, you can do that. Trouble is, that's not what your code is doing. It's modifying the value of a copy of the original variable, which will leave the value of the original variable (pstr in your case) unchanged.
|
|
|
|
|
Hmmm, thanks. I guess i thought both pointers contained the same address but upon printing them out i see the copy contains its own unique address.
I haven't seen the 'reference to a pointer' frag before, do you know of a good resource that deals well with this kind of stuff?
The books i have only scratch the surface.
thanks again.
|
|
|
|
|
Tutorial at Cplusplus.com
This and many others can be found by Googling: C++ pass pointer by reference
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
How can I read Registry subkey using Win API
|
|
|
|
|
|
Hello:
Navigation in visual studio seems a big prob when u are working on a big solution, the bookmarks provided in VS only help us navigate within the same file , what if we have to go from one file to another of different projects , can any one recommend me some solution
Thanks
Muhammad Ahmed
Ahmed
|
|
|
|