Returning a CHAR[] from a function



I have the following function that returns the path of where the
program was run from.
However I cant seem to return the butter as a CHAR. The code works if I
use it in a procedure but not where I need to return the variable CHAR
buffer.

char CAutoRunDlg::GetProgramPath(void)
{
char buffer[_MAX_PATH]; //declares maimum path
//opens window maximized
//_getcwd(,)gets the current working directory
// #include <direct.h> //needed for current working directory

/* Get the current working directory: */
if( _getcwd( buffer, _MAX_PATH ) == NULL )
perror( "_getcwd error" );
else
printf( "%s\n", buffer );

return buffer;
}

.


Loading