|
i am already use the for loop to chek all value of iteration.
is there no any method to find dirctly the value in iterator without using for loop to chk all value,
thanks.
|
|
|
|
|
Sure.
You can do something like (i + 2)->first; or (i + 2)->second; .
|
|
|
|
|
i dont understand can u please more specific.
or please provide me any example.
|
|
|
|
|
Not sure what you're asking here; if you know the 'real' key (CString- DWORD) you could use a find on the outer map and another on the second of the returned iterator...
Hoe this helps, AT
Cogito ergo sum
|
|
|
|
|
I have a problem with convertion between string and double as following:
double dValue = 1000;
std::ostrstream oStrStream;
oStrStream << dValue << std::ends;
std::string strValue = oStrStream.str();
//here strValue is "1,000", a comma is added!
//when I use following code to convert, error occurred.
double dValue = strtod( strValue .c_str(), NULL );
//here dValue is "1", it seems "," can't be recognized!
How to avoid this? Is there any way to avoid adding comma when convert double to string?
|
|
|
|
|
ostrstream is not supported anymore.
Try using ostringstream ;
|
|
|
|
|
I got the same result. The problem was not solved yet.
|
|
|
|
|
The problem is due to ',' in '1,000'. Remove ',' and it would work.
|
|
|
|
|
You need to parse the string to remove non-numeric characters before trying to convert it. The string is only allowed to follow a specific pattern, as described here[^].
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I could be wrong here, didn't verify yet, but using the setlocale to LC_NUMERIC for US English shoul make it recognize the thousand seperator as well.
Always consider that there are languages (mine included) that use a different decimal seperator.
Cheers, AT
Cogito ergo sum
|
|
|
|
|
If you look at the link I provided you can see which characters may be accepted.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi All,
I have to retreive the full path of the COM Dll (named "MyDllCom") from an other Exe.
How do this ?
|
|
|
|
|
If you know the CLSID of the component, you can get the DLL path from the value of the registry key HKEY_CLASSES_ROOT\CLSID\<CLSID of COM>\InprocServer32\(Default) .
|
|
|
|
|
Back on form I see!
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
|
|
Hello,
I've started moving a MFC MDI application from VS2005 to VS2010 (used the samples Visual C++ 2008 Feature Pack as source) and got some problems with the menu now using CMFCMenuBar.
Normally all the menu items are customizable by the user, but I want to protect the main menu items File, Edit, View, Help, ... from user customizing and only allow the user to add his own main menu(s) to the menu bar.
I thought using CMFCToolBarButton::SetProtectedCommands but that doesn't help for the main items, for the sub menu items this works.
I found also out that I could add the 0 with the call lstProtectedCmds.AddTail( (UINT)0 ); to the protected commends but this prevents the menu bar completely from customizing and the user isn't able to add his own menu to the bar any more.
Any help or ideas are welcome.
Thanks,
Andreas.
|
|
|
|
|
Hi All,
How to reyurn char* in c++? My code is
extern "C" char* callFunction()
{
std::string stroutput = pObject->ProcessNumber("hi","hi");
char* strout = new char [stroutput.size()+1];
strcpy (strout, stroutput.c_str());
return strout;
delete[] strout;
}
Thanks in advance...
G.Paulraj
|
|
|
|
|
What you've done is almost correct.
2 things are not right.
First, you cannot use extern "C" if you're using std::string because string is an object of the basic_string class.
class is not understood by C.
Second, you cannot delete the memory inside the function.
Deletion has to be done by the caller.
Also there is no point in having any statements after the return statement.
|
|
|
|
|
«_Superman_» wrote: First, you cannot use extern "C" if you're using std::string
The extern "C" merely prevents name decoration of exported function or variable names, it has nothing to do with the underlying C++ code, which may use any classes internally.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
You're right. My mistake.
|
|
|
|
|
«_Superman_» wrote: My mistake.
The first I've seen from you; you must be having a bad day!
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
The worst. !!!EVER!!!
Need to cool off . Going to the bar.
|
|
|
|
|
The delete[] will never execute, because you are return ing before you get to it.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Richard and Superman,
Thanks for your reply.
Actaully i supposed to return std::string.
The thing is, this is a dll. and i am calling this dll from c# application.
If i return like
return "some value";
this is working fine. but if i return like,
char* str; or std::string str;
return str;
the output is not coming correctly.
from c# i am calling like
String str = somefunctionname();
How can solve this issue?
G.Paulraj
|
|
|
|