|
Wouldn't that be akin to driving a brad with a sledge hammer?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Why? lexical_cast is intended exactly for such scenarios. All he needs to do is to include a header file and then to use it like:
double dVersion = lexical_cast<double>("2.5");
Much easier than sscanf and atof, isn't it? Not to mention that it throws in case of error, unlike atof which returns 0
|
|
|
|
|
How is
double dVersion = lexical_cast("2.5"); any easier than
double dVersion = atof("2.5"); The former requires at least another header file while the latter does not.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
For one thing, there is only one lexical_cast and for each type of conversion (string to float, string to int, int to float...) you have a different version of ..to.. function.
But, even more important, atof is simply broken. Consider:
int i = atoi (argv[1]);
if (i == 0)
{
}
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
The concern was which statement easier to use in a specific context, not which was better adept at error handling or which was more robust.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
i don't want to "do myself a favor", for the only reason that i don need it.
my problem is very simple, but i can't figure it out by myself for now...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi Everybody,
In my application, i want to erase the particular rectangle area in the client area. I tried using "InvalidateRect()" function. But finally i got the result as erasing of whole screen. Please give some suggestions regarding that.
Actually when we call InvalidateRect function, it invokes the OnPaint() method. In OnPaint() method how can we get the rect region that specified in InvalidateRect() ?
Regards,
Prakash.
A Journey of thousand miles must begin with a single step.
|
|
|
|
|
.....well.....
hmmm.....
when u give the InvalidateRect command.....it implies invalidate the whole area.....since
InvalidateRect()----------->meanz....Invalidate(TRUE);
try using.....
Invalidate(FALSE); //THIS ONLY UPDATES THE CHANGES.....NOT THE WHOLE SCREEN.....
hope that helpz.....
happy programmin.....
cheerz.....
|
|
|
|
|
i hope to display messageBox in the way of "always on top", that is - HWND_TOPMOST.
do you know how to do that?
if no, is there another easy-to-use dialog similar to MessageBox which can be displayed "always on top"?
thx
includeh10
|
|
|
|
|
You can make a messagebox stay on top by adding the attribute MB_SYSTEMMODAL.
Short example :
LPCTSTR lpszText = "my message text ....";
UINT nType = MB_OK | MB_SYSTEMMODAL;
UINT nIDHelp = 0;
int iResult = AfxMessageBox( lpszText, nType, nIDHelp );
|
|
|
|
|
System-modal message boxes should be used sparingly (e.g., use them to notify the user of serious, potentially damaging errors that require immediate attention) because all applications are suspended until the user responds.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I want to implement RSA coding in my programm, but it deals with VERY BIG INTEGERS, so i want to find any library to work with that big integers...
|
|
|
|
|
What are "VERY BIG INTEGERS?" Is 264 not large enough?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
No, it will not be enough, i want to use big integers not 32 bits, or 64 , i want to use 100MB integer, so....
|
|
|
|
|
What does 100MB integer mean?
I have seen classes that deal with 128bit integers but that is as far as I have seen them. Basically they are based on two 64bit integers.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Antony M Kancidrowski wrote:
What does 100MB integer mean?
Whew, for a minute there I thought a new number was being invented. Glad I'm not the only one that needed clarification.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Whell let me explain my problem:
I got next sructures of data:
struct Station
{
CString Name;
ULONG Number;
CTime TimeArrivial;
CTime TimePlannedArrivial;
ULONG TimeAccuracy;
};
struct Vehicle
{
CString Name;
ULONG Circle;
vector <Station> vStations;
};
vector<Vehicle> vVehicles;
So, i tried to pack it in SafeArray, but i don't know right it or not:
struct saStation
{
BSTR Name;
ULONG Number;
LONG TimeArrivial;
LONG TimePlannedArrivial;
ULONG TimeAccuracy;
};
struct saVehicle
{
BSTR Name;
ULONG Circle;
SAFEARRAY *psaStations;
};
then i pack it:
SAFEARRAYBOUD rgsabound[1];
rgsabound[0].cElements = vVehicles.size();
rgsabound[0].lLbound = 0;
SAFEARRAY* pMainArray = SafeArrayCreate(VT_VARIANT,1,rgsabound);
saVehicle* psaVehicles;
SafeArrayAccessData(pMainArray,(void**)&psaVehicles);
for(int i = 0;i<pMainArray->rgsaboud[0].cElement;i++)
{
psaVehicles[i].Name = vVehicles[i].Name.AllocSysString();
psaVehicles[i].Circle = vVehicles[i].Circle;
SAFEARRAYBOUD rgsastationbound[1];
rgsastationbound[0].cElements = vVehicles[i].vStations.size();
rgsastationbound[0].lLbound = 0;
psaVehicles[i].psaStations = SafeArrayCreate(VT_VARIANT,1,rgsastationbound);
saStation* psaStation;
SafeArrayAccessData(psaVehicles[i].psaStations,(void**)&psaStation);
for(int j = 0;j<vVehicles[i].vStations.size();j++)
{
//Fill In The psaStation...
//....
}
SafeArrayUnaccessData(psaVehicles[i].psaStations);
}
SafeArrayUnaccessData(pMainArray);
But, whe i try to call SafeArrayDestroy(pMainArray) i got an error...
First got all the data from vehicle and stations, then SafeArrayDestroy to Stations,
after all this i call SafeArrayDestroy to pMainArray, and my programm crashes with assembler text in my visual studio, in function call stack i got NTDLL something like this...
What's wrong here??
And Another question:
If i want to create a multidimensional safearray, can i do next
SAFEARRAYBOUD sab[10];//for example???
Will it be 10 dimensional Array?
|
|
|
|
|
Your data structures aren't VT_VARIANT, they are VT_RECORD.
You can define structures in an IDL file, and use SAFEARRAY(structname) in the IDL, just like SAFEARRAY(BSTR) or SAFEARRAY(LONG). If the base types are all oleautomation compatible, then you don't need to worry too much about marshalling.
To create and populate an array, you need stuff like this;
CComPtr<irecordinfo> spRI;
hr = GetRecordInfoFromGuids( LIBID_MyLib, 1, 0, 0x409,
__uuidof(structname), &spRI );
if (SUCCEEDED(hr))
{
SAFEARRAY* psa;
structname * pdef;
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = 500;
psa = SafeArrayCreateEx( VT_RECORD, 1, rgsabound, spRI );
if (psa)
{
SafeArrayAccessData(psa, (void**)&pdef);
// can now access pdef[0].xxx, pdef[1].xxx etc
SafeArrayUnaccessData(psa);
}
}
Does that help any?
Steve S
Developer for hire
|
|
|
|
|
Hello, thank you, it helped, but how to define my structure in IDL File???
|
|
|
|
|
like this:-
----------------------------------------
#ifdef __midl
typedef
[
uuid(9CB2EA23-FFFF-46e6-B718-43E57261F306),
version(1.0),
helpstring("Catalogue Info (with permissions)")
]
#else
struct __declspec(uuid("9CB2EA23-FFFF-46e6-B718-43E57261F306")) CATINFO;
typedef
#endif
struct CATINFO
{
BSTR bstrCat;
long lPerms;
}
CATINFO;
----------------------------------------
By putting this in a header file (.h) and using #include in your IDL file, you'll get a file you can use in IDL and in C++. Obviously, you need to put your own UUID values in place;
Steve S
Developer for hire
|
|
|
|
|
Hello !
I had a project with CMyFormView.
I added new form named CDocExample with base class CFormView, how can i switch to CMyFormView to CDocExample ?
Please help me.
Thanks.
|
|
|
|
|
Assuming that CMyFormView is derived from CFormView. You ought to be able to replace all instances of the text "CFormView" within CDocExample with "CMyFormView".
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
May not be a good assumption
Perhaps the original question meant "I want to switch views at run-time".
If this is the case then Q99562 in the VC++ knowledge base might help.
Steve S
Developer for hire
just think how much CP bandwidth would be saved if everyone searched the MSDN library first.
But then, how would the rest of us feel so smug?
|
|
|
|
|
Hi all,plz help me to read the *.doc files,i don't know the structure of this file so i cannot read them.Thanks a lot!
tien mkjerhk wjh
|
|
|
|
|
Can't you just use Word for this? If not, you may get lucky and find the file's format at www.wotsit.org.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|