|
The ToString method will allow you to specify a format. Assuming you're not in the wrong forum and are using .NET
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi ,
i am trying to get the object name, see the code below, but not able to find method, what could be the code in place of ???????.
#include "iostream"
using namespace std;
class A{
public:
int i;
void printObjectname(){
cout << ????????;//<--what could be here, to print the object name as 'objectA'
}
};
int _tmain(int argc, _TCHAR* argv[])
{
A *objectA = new A();
objectA->printObjectname();
return 0;
}
santosh
|
|
|
|
|
Hi,
this can not be done.
new A() is an object, it could have a name.
objectA is not an object, it is a variable, it holds a reference to the
class A object. There could be many more references to the same object, it suffices
to do A* objectB=objectA; , now how would the class A object have to know
the name of all the variables pointing to it, and in particular the one you want??
Suggestion: give your objects a name by providing a Name property and/or a name argument
in their constructor, so new A("aha"); would create a new class A object and
give it the name "aha". Now you can ask that object for its name, and/or you can override
its ToString() method so it identifies itself. Remark: this works independently of the
variable(s) that may refer to that object!
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hello. I have to parse an HTML file and extract data from it. Currently I load it into Excel and then save as a .csv file. Then I load the .csv file and parse that. I now have to get the data directly from a web page into .csv format. Has anyone out there attempted something similar. Thank you.
Tom Paronis
|
|
|
|
|
Are you using C++ and .NET ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm using VC++ 6.00 and Visual Studio 2005. I think IHTMLDocument will help me but I can't figure out how to implement it. I'm scouring the web for an example.
Tom Paronis
|
|
|
|
|
OK, so VC6 doesn't use .NET. VS2005 does. If you're not using .NET then you're in the wrong forum. Try the Visual C++ forum.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Friends,
In socket programming I want to connect double byte charcters.
Earlier we used recv() function for single byte charcter.
If we use double byte chracter in below recv function, its coming as a question mark symbol.
If anybody knows how can I handle double byte charcter in Scoket programing(recv function),Please let me know.
My codesnippet:
while( bytesRecv == SOCKET_ERROR ) {
bytesRecv = recv( ConnectSocket, recvbuf, 64, 0 );
if ( bytesRecv == 0 || bytesRecv == WSAECONNRESET || CheckTimeOut()) {
return CloseListen();
}
}
Note:Here recvbuf works for singel byte not for doublebyte charcters.
Thanks in advance.
|
|
|
|
|
Looks like you're in the wrong forum. C++/CLI is C++ with .NET. You want the visual C++ forum.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi all,
Is there something in boost that I can use to check if a file is existing and if the file is working.
for example string file = "c://sample.doc", is there something from boost that can see if the sample.doc exists in c: directory?
Thanks,
Jj
|
|
|
|
|
AS you're using .NET, use File.Exists. If you're not using .NET, try using the right forum.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Christian,
I am just using regular c++ at visual c++.
Thanks
|
|
|
|
|
OK, so then you're in the wrong forum. The Visual C++ forum is the one you want
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
can anybody explain me how the size of an empty class is 1byte
thanks in advance
|
|
|
|
|
Did you mean to ask this in the .NET forum ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
STOP READING THE DOCUMENTATION!
What do you think your are, a software developer or something?
|
|
|
|
|
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It's funny - Google makes billions, yet only a few of us know how to use it
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Actually the whole thing sort of makes sense. Years back before the web was so large, forums and news groups were a logical mechanism for gaining information. Now anyone that is capable just searches and finds it, most of the time. So now in these forums we are left pretty much with the not capable category ( filet-o-fish). I bet the VB forum is very busy, and C# isn't far behind it!
|
|
|
|
|
The C# forum is WELL behind the VB.NET one....
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I hate filet-o-fish. It is just not natural. A tasteless by product with lots of guts.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi, I'm using Visual Studio 2005 C++/CLI. I have a TreeView Control that displays a few nodes with some sub-nodes in each. I have written the application so if I right click on a sub-node I get a ContextMenuStrip where I can select "MenuItem". If I left click on a sub-node FIRST (thus selecting the node) then right click to select "MenuItem", I can then use...
TreeNode^ selectedNode = this->treeViewInstruments->SelectedNode;
...to get a copy of the selected node. However, if I DO NOT left click on the sub-node first and simply right click on it and then select "MenuItem" the above line of code returns an undefined value. I added code to respond to the mouse right click on a node but I can't seem to set the node as selected. I just want to be able to "set the node I just right clicked on to the selected node".
Thanks
Buck
|
|
|
|
|
Sorry, I didn't get you... Are you trying to select a tree item using the right click?
|
|
|
|