Hi everybody, I would like to create a function which could allocate memory for any of pointer of pointer declared. In my class C, i consider 2 pointers of pointers : **p and **q ( declared as public in class C), i would like to create a function AllocMemPointerOfPointer, which takes 3 input : RowSize, ColSize and Pointer. The function doesn't return value. It just allocate memory for Pointer, which is a pointer on RowSize pointers of any type . How could i do that without allocate memory to a "copy" of Pointer ? I hope my question is clear ! if not, feel free to ask me more informations ! Thanks in advance for your answers Gerald
Gerald Mercet
Posts
-
memory allocation -
memory leak debuggerHi everybody, I would like to know if someone could tell me if a debugger made to find memory leak problem exist for windows environment & if it's ok where i could find it? Some of my friends tell me about a software called "valgrind" which only works under linux environment! Thanks in advance for yours answers Gerald
-
memory problem!you're right, sorry for this stupid mistake and thanks for your help
-
memory problem!Sorry just a little mistake in my answer: "both *pInflex and *(pInflex+i) have a correct value (equal to 15)", not really important i know, but..!
-
memory problem!i'm not sure because i have tested at the same time and both *pInflex and *(pInflex+i) have a correct value (equal to 0). i have seen it in the debug window!
-
memory problem!Hi everybody, Perhaps a simple question but, i would like to suggest it o you: In my application, i have an "access violation" message which appear to this following line: *(pHistoDBNorm+ j- *(pInflex+i)- *pInflex), when i=0 and j=16, just with this indications, you will tell me to check if th e allocation is well done, but the problem is if i remove *(pInflex+i)- *pInflex (which is equal to 0), in the debug window, the following *(pHistoDBNorm+ j) is evaluated correctly whereas *(pHistoDBNorm+ j- *(pInflex+i)- *pInflex), always in the debug window couldn't be evaluated (instead of reading a value which would have to be the same than *(pHistoDBNorm+ j), i could read something like that:"expression couldn't be read..." why?????? thanks in advance gerald
-
problem in InitInstanceYour method works if i choose Win32 Release mode for debugging my application, but with debug mode it doesn't work anymore, why?
-
problem in InitInstanceFor your first question i answer : yes I'm sorry, but i'm not sure to understand exactly what you mean by adding "no fail create" style how could i do that?
-
problem in InitInstanceHi everybody I don't understand why this morning when i tried to start my dialog based application, the message box has opened with the following message: Uhandled exception in Fractal_v1_0.exe:0xC000005: Access Violation So i've found that this problem comes from the following line of code in the function InitInstance: m_pMainWnd=&Dlg; The big problem is that my application used to run before, so is anybody could explain me where could this problem come? Thanks in advance gerald
-
using setvalue in excel automationsorry to be late to answer you. Just to tell you that your solution works, thanks a lot
-
using setvalue in excel automationok i will try, and i'll tell you if it works thanks a lot
-
using setvalue in excel automationI've created an application which automates excel 97 (thanks to the help of the microsoft supports articles Q178749, for example). As i want to automate excel, with office 97, i need of the following library Excel8.olb. So, in my project I would fill some range in an excel worksheet, to do it i use the function setvalue, which takes (with office 97) only one parameter, a COleVariant; but now here is my problem, when i try to do the same thing with office XP( i've seen that i have to replace excel8.olb, by excel.exe) the same function need of 2 input parameters, now!!! Setvalue(COleVariant, COleVariant). One of this parameter is naturally the same that hte one i've used with excel 97, but the second one, i don't what i ve to put! I'm sorry of my approximating english, but if someone could understand me and help me to solve this problem, he will be really great thanks in advance for your help Gerald
-
for excel automationno i use VC++ 6.0
-
for excel automationHello, In the samples given on microsoft support (Q178749: HOWTO Create automation project using MFC and a type library) we have to select Microsoft Excel 8.0 Object Library if we use excel automation. But what could i do if i have office XP on my workstation? thanks in advance gerald
-
a "user breakpoint..." message i don't understandI initialize to NULL in the constructor, the problem arrive when i don't want to use pHistoDBNorm anymore i want to delete memory, and it doesn't work!!!
-
a "user breakpoint..." message i don't understandwhen you tell me about "deletable block of memory that was allocated", what do you mean about "deletable", because you could see in the following code how i allocate memory for this pointer: void LoadHistoDB::AllocHistoNorm(long NumHisto) { DeleteHistoNorm(); pHistoDBNorm=new double[NumHisto]; } do you think when you see the delete function that there is a problem? thanks gerald
-
a "user breakpoint..." message i don't understandHi everybody, In my application i have created a simple function which delete memory of specific pointer, you could find its following code: void LoadHistoDB::DeleteHistoNorm() { if(pHistoDBNorm!=NULL) { delete[] pHistoDBNorm; pHistoDBNorm=NULL; } } but when i call this function in debug mode, i could read in a message box this following: "User breakpoint called from code at 0x77f8629c" and when i try to debug step by step (with F11 ) it calls this function: void __cdecl operator delete(void* p) { #if !defined(_AFX_NO_DEBUG_CRT) && defined(_DEBUG) _free_dbg(p, _NORMAL_BLOCK); #else free(p); #endif } and the if condition is verified so i have the message box mentionned above so if someone could explain me where is the problem? thans in advance gerald tell me if you need the whole code
-
a problem in memory allocationI try to follow first the allocation describe by the function called AllocComptStartEndMin, and you know as usual when you do the allocation of memory for a pointer of "double" for example, p=new double[X]; when you try to see what are the value, for each i from 0 to to X-1 of p[i], (before any affectation), in the debug window, you have in this window: p[i] in the column "Name" and -6.2774385...e+066 in "Value" column. So when i execute step by step AllocComptStartEndMin, it works even if i>120. So, why when i want to affect value to the pointers i can't affect value for the first pointer when i>120 ( and what is very strange is this value:120, because in my sample RowSize =866 and ColSize=255!)
-
a problem in memory allocationHi everybody, I have a strange problem with an allocation of memory for pointers of pointers. i have done this function to allocate memory for 2 pointers of pointers: void LoadHistoDB::AllocComptStartEndMin(long RowSize,long ColSize) { long i; pComptStartMineure=new double* [RowSize]; pComptEndMineure=new double* [RowSize]; for(i=0;i120 i could see in the debug window this message in front of pComptStartMineure: CXX0030:expression cannot be evaluated and i could see this same message for pComptEndMineure when i>202. So where is the problem? Thanks in advance for your help gérald
-
about function GetResize()Hi, I ve read into an article (Q186120) of microsoft knowledge base, which explain how to fill a range with an array. But when i test it , it doesn't work really well. In fact, i don't realy understand how works the function called in the sample GetResize(), because when i test my application (which is based on the application described in the article, but which can't fill cells with string element)which simply have to fill some excel's range with the figure "1", and when i run my application it just fill the cell "A1"! Why? Thanks in advance for your answer gerald