ConsoleTom
Member
Here i need SelectFile to return a string.
Is this example ok ? Should i allocate memory in this case ?
...
strcpy(cInputStr,SelectFile("test"));
...
char* SelectFile(char * strStartPath)
{
char * cOutStr;
cOutStr = gm_malloc(256);
strcpy(cOutStr,strStartPath);
gm_free(cOutStr);
return cOutStr;
}
Is this example ok ? Should i allocate memory in this case ?
...
strcpy(cInputStr,SelectFile("test"));
...
char* SelectFile(char * strStartPath)
{
char * cOutStr;
cOutStr = gm_malloc(256);
strcpy(cOutStr,strStartPath);
gm_free(cOutStr);
return cOutStr;
}