Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generaliostream file content modification questions Pin
Maxwell Chen21-Dec-07 20:15
Maxwell Chen21-Dec-07 20:15 
QuestionRe: iostream file content modification questions Pin
CPallini22-Dec-07 0:37
mveCPallini22-Dec-07 0:37 
GeneralRe: iostream file content modification questions Pin
Maxwell Chen22-Dec-07 2:58
Maxwell Chen22-Dec-07 2:58 
GeneralRe: iostream file content modification questions Pin
CPallini22-Dec-07 3:24
mveCPallini22-Dec-07 3:24 
Generaltray icon -right click option Pin
guru moorthy.k21-Dec-07 19:01
guru moorthy.k21-Dec-07 19:01 
GeneralRe: tray icon -right click option Pin
Mark Salsbery22-Dec-07 7:23
Mark Salsbery22-Dec-07 7:23 
Generalcannot create unicode file using wofstream Pin
xanagan66621-Dec-07 18:02
xanagan66621-Dec-07 18:02 
Generalproblem about alloc memory in another library and free in the main project Pin
kcynic21-Dec-07 15:01
kcynic21-Dec-07 15:01 
I have a program using another dll library of mine.There are some codes like this:
//caller
std::string* paths = NULL;
int count = find_path_strings(&paths);
if(count>0)
delete [] paths;//error occurs here,the error message tells me that the heap memory is damaged

//in the library
int find_path_strings(std::string** paths)
{
char** paths_array = NULL;
int count = find_paths(&paths_array);//this function will alloc the paths_array
//also will initilize it and return the array element count
*paths = new std::string[count];
for(int i=0;i < count;++i){
(*paths)[i] = paths_array[i];
free(paths_array[i];
}
if(paths_array)
free(paths_array);
return count;
}

but if I copy the source codes in my library to the main program(caller),it will works well.(I using the library with a .dll and a .lib file.)
Someone would tell me why and how to resolve such strange problem?
Thanks.

GOOD LUCK.
GeneralRe: problem about alloc memory in another library and free in the main project Pin
Mark Salsbery21-Dec-07 15:10
Mark Salsbery21-Dec-07 15:10 
GeneralRe: problem about alloc memory in another library and free in the main project Pin
kcynic21-Dec-07 15:26
kcynic21-Dec-07 15:26 
GeneralRe: problem about alloc memory in another library and free in the main project Pin
Mark Salsbery21-Dec-07 15:33
Mark Salsbery21-Dec-07 15:33 
GeneralRe: problem about alloc memory in another library and free in the main project Pin
kcynic21-Dec-07 18:16
kcynic21-Dec-07 18:16 
GeneralRe: problem about alloc memory in another library and free in the main project Pin
Stephen Hewitt21-Dec-07 19:30
Stephen Hewitt21-Dec-07 19:30 
GeneralRe: problem about alloc memory in another library and free in the main project Pin
kcynic21-Dec-07 19:41
kcynic21-Dec-07 19:41 
GeneralRe: problem about alloc memory in another library and free in the main project Pin
kcynic21-Dec-07 21:05
kcynic21-Dec-07 21:05 
GeneralNumber Lock activation Pin
Larry Mills Sr21-Dec-07 13:52
Larry Mills Sr21-Dec-07 13:52 
GeneralRe: Number Lock activation Pin
Mark Salsbery21-Dec-07 14:59
Mark Salsbery21-Dec-07 14:59 
GeneralRe: Number Lock activation Pin
Larry Mills Sr22-Dec-07 9:50
Larry Mills Sr22-Dec-07 9:50 
Question.RC file formating differences Pin
KayakCoder21-Dec-07 10:40
KayakCoder21-Dec-07 10:40 
GeneralI hate programming today (project conflict/calling convention conflict, ... ) Pin
Maximilien21-Dec-07 7:24
Maximilien21-Dec-07 7:24 
GeneralGetting the bitmap in and out of a CGIPLUS Image class Pin
Anthony Appleyard21-Dec-07 6:39
Anthony Appleyard21-Dec-07 6:39 
GeneralRe: Getting the bitmap in and out of a CGIPLUS Image class Pin
Mark Salsbery21-Dec-07 7:32
Mark Salsbery21-Dec-07 7:32 
GeneralRe: Getting the bitmap in and out of a CGIPLUS Image class Pin
Anthony Appleyard21-Dec-07 12:19
Anthony Appleyard21-Dec-07 12:19 
GeneralRe: Getting the bitmap in and out of a CGIPLUS Image class Pin
Mark Salsbery21-Dec-07 12:39
Mark Salsbery21-Dec-07 12:39 
GeneralRe: Getting the bitmap in and out of a CGIPLUS Image class [modified] Pin
Anthony Appleyard21-Dec-07 23:29
Anthony Appleyard21-Dec-07 23:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.