|
I have the following already implemented...
A base class (Say A) with a macro definition implementing two functions. Say A1 and A2.
A class ( Say B) derived from Class A.
Member functions of B called A1 and A2.
Now I have a need for the following...
Without changing any code in the derived class B or its member functions I want to know inside A1 or A2 functions the function/line number/file from which A1 or A2 gets called.
Is this possible??
|
|
|
|
|
Correction to my question
I have the following already implemented...
A base class (Say A) with a macro definition implementing two functions. Say A1 and A2.
A class ( Say B) derived from Class A.
Member functions of B called B1 and B2.
B1 calls A1
B2 calls A2.
Now I have a need for the following...
Without changing any code in the derived class B or its member functions I want to know inside A1 function the function or line number or file from which A1 gets called.
i.e I cannot change the derived class(es). I can only change the base class.
Is this possible??
|
|
|
|
|
it's not going to be easy, but you should probably start here[^]
|
|
|
|
|
Thanks for your reply. But I dont want to use this approach. This was in my mind. I do realize that it might just not be possible otherwise.. Just wanted to throw my question out there to see if anybody has idea..
Thanks
|
|
|
|
|
as far as i know, there's nothing in C or C++ that can tie a function at runtime back to the source. to do that you need external support (like debugger PDB files or OS things like stack walkers)
|
|
|
|
|
Dear ALL
now i was makeing a small ping app. and i read alot about it and i take some codes from the internet and after some problems it worked at the end but i wished to be sure that packets which were sent are eaxctly what i set it so i used wireshark software to see each ICMP packets
i was sending 150 bytes discoverd the real one which was sent is 12 bytes !!!
i check it using windows Ping (MS Ping) it worked so fine
so i thought the problem is in my code , i tried many of ping codes in the net & almost no one send the right packet size !!!!!!!!
so what i should check?? anyone has idea about such problem??
thax all
bye
|
|
|
|
|
check your hardware setting,,, maybe some errors there,,,
|
|
|
|
|
Thx for your reply
but what hardware setting ??
nothing in the socket programming related to hardware
and i tried MS ping in the same PC and it worked so fine
thx
bye 
|
|
|
|
|
Please Explain what exactly are you trying to do.
Did you analyse exactly what was shown by wireshark. Please post it so we know more info.
My guess is you icmp message was 12 byte but the whole packet encapsulated by lower layers(udp and ethernet frame) made it to look of wrong size to you but is of correct size.
the icmp reply also contain the orginal ping request which is again of different size.
Did you send 12 bytes and wireshark showed 150 byte.
or you sent 150 bytes and wireshark showed 12 bytes.
Just check what data are you giving to the socket????
|
|
|
|
|
Hi All,
As part of my VC++ 6.0 conversion to VC++ 9.0 i am facing a problem with this piece of code.
_variant_t GetTimeStamp()
{
.......
.......
return _variant_t(COleDateTime::GetCurrentTime(),VT_DATE); // This fails with VS 6.0 also if i use it in a new sample application
}
.....
.........
bool curtime = floor(GetTimeStamp());
In this piece of code i get an error
Error 89 error C2668: 'floor' : ambiguous call to overloaded function
Thank you.
|
|
|
|
|
Maybe
return _variant_t(COleVariant(COleDateTime::GetCurrentTime()));
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Calling floor on a VARIANT doesn't make sense, you need to pass a floating-point type to floor . Use one of the _variant_t conversion operators (double , float , etc.) and pass the result of that to floor
|
|
|
|
|
how can i map size of any file to 0.
please provide me the codes in c++
|
|
|
|
|
indiraagandhi wrote: how can i map size of any file to 0.
Uuh ? What do you mean ?
|
|
|
|
|
hi cedric
i am working on one module & their i want to hide the size of file from unauthorised user so he is unable to read that file for that i want some help
|
|
|
|
|
Hi,
to truncate a file, you can open it for writing, then close it.
|
|
|
|
|
What no codes?
led mike
|
|
|
|
|
led mike wrote: no codes?
No C++ codes today. Am still recovering from a little Fortran experience. All upper-case.
|
|
|
|
|
int MapFileSizeToZero(size_t filesize)
{
return 0;
}
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]
|
|
|
|
|
Damn, you read my mind
Regards,
--Perspx
"A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year." -Andrew Tanenbaum
"Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer." -Fred Brooks
|
|
|
|
|
BTW: the quotes in your sign are wonderful.
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]
|
|
|
|
|
CPallini wrote: BTW: the quotes in your sign are wonderful.
Thank you I'm always sure to pluck them carefully from Wikiquote from my plethora of knowledge
Regards,
--Perspx
"A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year." -Andrew Tanenbaum
"Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer." -Fred Brooks
|
|
|
|
|
Hi,
When using overlapped named pipes for Interprocess comunication between a Dos Console Program Acting as The Server and A Windows 32 GUI acting as the Client or Child Process
Do I have Share the hEvent Kernel Object which is part othe Overlapped Structure
Between the Dos Console program (which creates it) and The Windows Program
I would think so ...
Any insight about this issue would be appreciated
|
|
|
|
|
ForNow wrote: Do I have Share the hEvent Kernel Object which is part othe Overlapped Structure
Even if you could share an event across processes, why? What are you going to do with it?
From your post it seems likely you have not yet stabilized your understanding of Overlapped I/O and perhaps IPC in general.
led mike
|
|
|
|
|
The way I understand Overlapped or async . I/O is the following
In the Server or Dos Program (in my case) I do a CreateNamePipe
Create The hEvent via CreateEvent for the hEvent which is part of Overlapped stucture
I then do a Connectnamed pipe waiting for the Client (in My case Windows Program ..started with CreateProcess)
to connect
In the Client (my Windows program) does A CreateFile which effectivly establishes the connection
with FILE_FLAGGED_OVERLAPPED making this a async./overlapped connection
It was my understanding that If my Windows program were to do a WriteFile that hEvent of the Overlapped
structure would be signaled and that is Why I thought it was A KernelObject that had to be shared by the
Client (Dos Console) when doing the ReadFile or Have A WaitForSingleObject withe shared hEvent just before
the ReadFile
|
|
|
|