Click here to Skip to main content
15,879,535 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: c++ toolTip windowsforms graphics Pin
Richard MacCutchan17-Jan-17 22:21
mveRichard MacCutchan17-Jan-17 22:21 
GeneralRe: c++ toolTip windowsforms graphics Pin
SuchitraAB20-Jan-17 19:23
SuchitraAB20-Jan-17 19:23 
GeneralRe: c++ toolTip windowsforms graphics Pin
Richard MacCutchan20-Jan-17 22:20
mveRichard MacCutchan20-Jan-17 22:20 
Questionquery Pin
Member 1291798422-Dec-16 4:51
Member 1291798422-Dec-16 4:51 
AnswerRe: query Pin
Jon McKee22-Dec-16 5:42
professionalJon McKee22-Dec-16 5:42 
AnswerRe: query Pin
Patrice T13-Jan-17 0:10
mvePatrice T13-Jan-17 0:10 
QuestionPlease help memory management Pin
Member 1282783222-Nov-16 21:06
Member 1282783222-Nov-16 21:06 
AnswerRe: Please help memory management Pin
Jochen Arndt22-Nov-16 21:42
professionalJochen Arndt22-Nov-16 21:42 
There are problems (memory leaks). You must delete memory allocated with new when not used anymore:
C++
void CreateFolderPath(string Path)
{
    char *strFolderPath = new char[Path.size() + 1];
    strcpy_s(strFolderPath, Path.size() + 1, Path.c_str());
    _mkdir(strFolderPath);
    delete [] strFolderPath;
}

string ConvertIntToString(int cipher, int objintiger)
{
    string temp;
    char *Res = new char[cipher];
    sprintf_s(Res, cipher, "%02d", objintiger);
    temp = Res;
    delete [] Res;
    return temp;
}

For your first example there is even no need to copy the string. Just pass it to _mkdir():
void CreateFolderPath(string Path)
{
    _mkdir(Path.c_str());
}

GeneralRe: Please help memory management Pin
Member 1282783222-Nov-16 22:04
Member 1282783222-Nov-16 22:04 
Questionwhy c++ is still being used? Pin
babak111019-Nov-16 22:53
babak111019-Nov-16 22:53 
QuestionRe: why c++ is still being used? Pin
Jochen Arndt19-Nov-16 23:01
professionalJochen Arndt19-Nov-16 23:01 
AnswerRe: why c++ is still being used? Pin
John Schroedl21-Nov-16 4:12
professionalJohn Schroedl21-Nov-16 4:12 
AnswerRe: why c++ is still being used? Pin
Eddy Vluggen21-Nov-16 4:31
professionalEddy Vluggen21-Nov-16 4:31 
GeneralRe: why c++ is still being used? Pin
Afzaal Ahmad Zeeshan24-Nov-16 1:27
professionalAfzaal Ahmad Zeeshan24-Nov-16 1:27 
GeneralRe: why c++ is still being used? Pin
Eddy Vluggen24-Nov-16 1:51
professionalEddy Vluggen24-Nov-16 1:51 
GeneralRe: why c++ is still being used? Pin
Afzaal Ahmad Zeeshan24-Nov-16 2:13
professionalAfzaal Ahmad Zeeshan24-Nov-16 2:13 
GeneralRe: why c++ is still being used? Pin
Eddy Vluggen24-Nov-16 2:35
professionalEddy Vluggen24-Nov-16 2:35 
GeneralRe: why c++ is still being used? Pin
Afzaal Ahmad Zeeshan24-Nov-16 2:36
professionalAfzaal Ahmad Zeeshan24-Nov-16 2:36 
GeneralRe: why c++ is still being used? Pin
Munchies_Matt28-Mar-17 23:31
Munchies_Matt28-Mar-17 23:31 
GeneralRe: why c++ is still being used? Pin
Afzaal Ahmad Zeeshan29-Mar-17 5:32
professionalAfzaal Ahmad Zeeshan29-Mar-17 5:32 
GeneralRe: why c++ is still being used? Pin
Munchies_Matt29-Mar-17 21:13
Munchies_Matt29-Mar-17 21:13 
GeneralRe: why c++ is still being used? Pin
Richard Deeming24-Nov-16 1:58
mveRichard Deeming24-Nov-16 1:58 
GeneralRe: why c++ is still being used? Pin
Eddy Vluggen24-Nov-16 2:05
professionalEddy Vluggen24-Nov-16 2:05 
GeneralRe: why c++ is still being used? Pin
Munchies_Matt28-Mar-17 23:33
Munchies_Matt28-Mar-17 23:33 
AnswerRe: why c++ is still being used? Pin
Afzaal Ahmad Zeeshan24-Nov-16 1:38
professionalAfzaal Ahmad Zeeshan24-Nov-16 1:38 

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.