|
a1_shay wrote: delete arr[choose];
Why are you deleting this object?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
because this my exercise
the main idea is that i need to delete object.and later if the user choose case undo I WILL return from temp the object that i put out before
someone told me that i need to delete the object with delete and that only delete the object,from what i am traing i see that delete free the address of that pointer and that's why i can print the temp after that
void deleteobject(vector < figure3d *> &arr,int index,vector < figure3d *> &temp)
{
vector < figure3d * > :: iterator i=arr.begin();
temp.insert(temp.begin(),*i);
delete *i;
arr.erase(i);
temp[0]->print();
}
modified 1-Jun-12 18:14pm.
|
|
|
|
|
Well that will be difficult, considering you deleted the object you're pointing to.
delete arr[choose];
Doesn't remove the pointer from the array, it deletes the object pointed to by that pointer, and since you added the pointer to that object to the other vector, the pointer in the other vector now points to junk data.
Think of a pointer like an address, you gave your second vector an address to a house, then demolished the house. If it tries to go there, it won't find the house it expects to find.
|
|
|
|
|
i understand pointer .and that's why i wrote
temp.insert(temp.begin(),*i); //i save here the data not the address
to save the object before i delete it from the original
|
|
|
|
|
You'd be correct if insert took *i by value, but it takes it by reference (look at the method signatures here[^]). You're still giving it the object then deleting it. You need to explicitly make a copy of it.
|
|
|
|
|
can you please tell me how i need do that.becouse i try many things'and without succees
never mind thanks all
modified 1-Jun-12 18:56pm.
|
|
|
|
|
To preview xls file i call CreateFromFile or CreateFromClipboard and it works
But if xls file has password and i do not enter it then my program hangs. It gives switch to/retry message.
Is there any way to solve this problem
|
|
|
|
|
MKC002 wrote: Is there any way to solve this problem How about using Excel automation instead (where the password can be provided to the Open function)?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I want to show excel file contents in my own window
|
|
|
|
|
Ok, so what's the problem?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
CreateFromFile hangs my program.
If excel file contains some password and i call CreateFromFile for that file, it asks me to enter password. If i click on cancel button and do not enter the password then my program hangs. It gives retry/switch-to message. How to solve this problem.
|
|
|
|
|
MKC002 wrote: How to solve this problem. Use Excel automation instead, where the password can be provided to the Open() function.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I want to open excel file contents in my own window, not in excel window. Is that possible with excel automation?
|
|
|
|
|
MKC002 wrote: Is that possible with excel automation? Yes.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Thanks for confirmation
Is there any example available in VC++
Can you please give some link
|
|
|
|
|
|
I want to ask you something, from yours experience : how is the fastest way to handle data (1 - 10 000 items) ?
In serialized CMap object ? Or in xml file ? I want to simulate 3 - 4 SQL tables, but I don't want to keep it into database ... I work in VC6 (MFC). Thank you.
modified 1-Jun-12 5:42am.
|
|
|
|
|
Hash list is generally quickest, unless you can sort the data.
If you are going to be reading-writing to file though it doesnt really mater whet the structure is in memory snce the speed bottleneck will be the disk access.
==============================
Nothing to say.
modified 2-Jun-12 2:53am.
|
|
|
|
|
If your program isn't something that has to stay closed source you could try using Berkeley DB[^], I've found it works really well for simple DB style apps.
If you can't or won't go open source for whatever reason I've found (for me, your data may be used in a completely different fashion) that a two layered approach for fast disk data access works best:
- the data itself is stored in a file with fixed size records
- another file containing a sorted or hashed index of key against index in the data file
Generally I read the index into memory, bung it in a vector or map . When I need data I look the index up in the map and hit the disk for the data itself.
|
|
|
|
|
Very good ideea, I never use map from STL, I play only with CMap from MFC, and I like it ...
|
|
|
|
|
Flaviu2 wrote: I never use map from STL, I play only with CMap from MFC
You should rather do the opposite.
Veni, vidi, vici.
|
|
|
|
|
Yeah, STL is highly optimised. And highly used....
==============================
Nothing to say.
|
|
|
|
|
STL's map is implemented as a tree, which isn't as fast as hashing. MFC's CMap... classes and STL's hash map use hashing, so should be used if speed is the top goal.
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
Hi,
is it possible to call web service from java script? if so how to call. please provide me answer
|
|
|
|
|
You should try this link. [^]
Every new day is another chance to change your life.
|
|
|
|