|
And you need help with ???
|
|
|
|
|
Got wired?
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
I have just come across and resolved a pretty serious bug in my code, I am now wondering if there is a better way to prevent this sort of thing from happening altogether.
I have a class which has a dynamic array as a member. One of the functions of this class returns a const pointer to the array. My bug was that I called delete on this pointer outside of the class (and didn't set the pointer to NULL), which caused later calls to read the array to spit out errors. Is there a method of preventing a pointer from being deleted outside of the class it was created?
|
|
|
|
|
WalderMort wrote: My bug was that I called delete on this pointer outside of the class
That goes against one of the benefits of C++ - encapsulation. I guess in theory you shouldn't
have been able to delete the pointer from outside the class. In practice (real life) it's
not always possible or practical to write classes that tight.
Bare minimum. IMO, class member variables should be handled in class member methods ONLY. If a
member can/should be freed while the object still exists then it should be done through a class
method. As always, this class method should do whatever it has to to mark the member as freed
to prevent misuse later (i.e. set to NULL).
I still am interested in seeing your skin app!
Mark
-- modified at 13:17 Saturday 18th November, 2006
|
|
|
|
|
COM targets this kind of problem (among many others): only pointers to methods are returned and object lifetime is controlled by reference counting.
|
|
|
|
|
Hi,
I am using CComboBox as dropdown menu. But how can I get edited item (string)?
GetLBText(0, str) always give me original string instead of edited one.
Thanks for your help in advance.
Nagaraju
|
|
|
|
|
if you want to access to editctrl on combobox you can use of GetComboBoxInfo
|
|
|
|
|
Hi,
Try:
int iIndex = GetCurSel();
GetLBText( iIndex, str );
You wrote: edited text - but the editing is already fiished ?
-----------
Mila
|
|
|
|
|
Are you looking for GetWindowText() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi
kindely help me in my project
#sanroop#
|
|
|
|
|
|
Sanroop wrote:
Hi
kindely help me in my project
you have search each string for that.... you can use strtod function! it return failure string if it alpha numeric
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
For each character in string use, isalpha() or isdigit() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
I have unsigned char * array which I get from Safearray.This is actually of 20 bytes.I should convert it to float array of size 5.
How can I do that?
When I do
lpData=new unsigned char[lngLogoSize+1];
for(long lBytesCopied=lb,i=0;lBytesCopied<lnglogosize;lbytescopied++,i++)
{
hr= safearraygetelement(varchunk.parray,&lbytescopied,(void="" *)&lpdata[i]);
}
lpdata[lnglogosize]="0;
lngOffSet" =="" 0;=""
="" checking="" for="" the="" value="" in="" first="" 4bytes="" of="" 20="" bytes="" i="" get=""
char="" arr[4];
int="" k;
for(k="0;k<4;k++)
{
arr[k]" =(char)lpdata[k];
}
arr[k]="\0" ;
float="" fltarr1="atof(arr);" iam="" getting="" (which="" is="" incorrect)
any="" suggestions="" please?
thanks=""
<div="" class="ForumSig">Today is a gift, that's why it is called the present.
|
|
|
|
|
Are you sure the source bytes are ASCII chars to be converted to a float value?
Or does the 20 byte array contain 5 floats, 4 bytes each?
|
|
|
|
|
Hi all!
I have a problem of copying and pasting on my SDI application. My view is derived from CFormView. I created some edit controls,... on it but when i run my application, i can't use Ctrl+C or Ctrl+V to copy or paste . Who can help me
Thank in advance!
Rgs!
|
|
|
|
|
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all:
Can I release a program without bring Msvcr80d.dll along? In other words can a program release without Msvcr80d.dll? What it is for exactly? It seems this dll is only used when you want to debug.
|
|
|
|
|
MSVCR80d.dll can not be redistributed. What you have to do is build the release version of your app and distribute it with MSVCR80.dll
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
PJ Arends wrote: MSVCR80d.dll can not be redistributed.
What do you mean by "REdistributed"?
|
|
|
|
|
Microsoft has already distributed the file with your development tools, that is how you got it. If you were to send it out you would be redistributing it.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
OK, thanks, now I understood what "Redistribute" means.
Please allow me to ask another question which is not about tech, but pure matter about language grammar.
you wrote: If you were to send it out
What "were to" in the above sentence means, is it a presumption like "If I were you"? Sorry, if this seems irrelevant.
|
|
|
|
|
Yes, it is a presumption. The word 'if' is what makes it a presumption.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Sorry for posting so much in a row I am just having severe problems that don't seem right. Anyway for the next I have very similar code. In the following code i get error C2440: '=' : cannot convert from 'Vector' to 'float'. I thought that the [] overload should return a float so why is it trying to convert it from a vector to a float?
Thanks for any help givin.
int main
{
Vector* Test1 = new Vector(3);
float Test10(0);
Test10 = Test1[0];
}
Base class Array header
float& operator[](const int RHS);
const float& operator[](const int RHS) const;
|
|
|
|
|
Test1 is a pointer to a Vector . Test1[0] is the same as *Test1 , which returns a Vector . What you want is (*Test1)[0] to call the operator[] method of the Vector object.
|
|
|
|