Q:

C++ Dynamic Memory Allocation. Assigning a Dynamically allocated array of char* return variable to a char variable?

So I am trying to add a Dynamically allocated char* that is returned from a procedure named    
GetFileInputFromUser();

I dynamically allocate the memory for the return variable inside the procedure.
char* pstrReturnValue;

// Prime the loop
cout << "please enter a file location on your local machine (type 1 for default location) ";
cin >> strFileInputFromUser;

// Default location?
if (*(strFileInputFromUser + intIndex) == '1')
{
    // yes, Get the length
    intLength = strlen(strDefaultFileLocation);

    // Allocate memory
    pstrReturnValue = new char[intLength];

    // copy default location in
    for (intIndex = 0; intIndex <= intLength; intIndex += 1)
    {
        *(pstrReturnValue + intIndex) = *(strDefaultFileLocation + intIndex);
    }

return pstrReturnValue;

what I need is to add the return variable to another array of chars (Dynamically allocated).
void main()
{
bool blnResult = false;
ifstream ifsDataFile;
udtNodeType* pudtHeadNode = 0;
udtNodeType* pudtCurrentNode = 0;
udtNodeType* pudtNextNode = 0;
char* strFile;

udtNodeType udtReturnNode;

// Get the file path
strFile = GetFileInputFromUser();

blnResult = OpenFile(strFile, ifsDataFile);

// was it successful?
if (blnResult == true)
{
    // Yes
    // populate the list and, return the top node
    udtReturnNode = *PopulateList(pudtNextNode, pudtCurrentNode, pudtHeadNode, &ifsDataFile);

    // All done, close the file
    ifsDataFile.close();

    delete[] strFile;

    // Delete the list
    DeleteList(pudtNextNode, pudtCurrentNode, pudtHeadNode);

    // Delete proof
    PrintList(pudtNextNode, pudtCurrentNode, pudtHeadNode);
}

system("pause");
}

This is an exercise and as per the requirements, GetFileInputFromUser() has to be char* it has to return that pointer and I have to delete that pointer before I Dispose the LinkedList. My thing is this, I know how to dynamically allocate memory, and I know how to delete said memory, my problem is I can't just assign a value to a statically allocated char[], I cant loop through the return value to assign it cause I have to be able to get the return vale into something.
I have tried changing char* GetFileInputFromUser() to char& GetFileInputFromUser() hoping I could get the address at the location in memory, and see if I could hopefully work with it that way be de-referencing the return value somehow.
If you comment out delete[] strFile and run it, it runs fine, but I am leaking memory, and that is no good in my eyes. I know there is a way to do this but google isn't helping and I have been stuck on this since 1am last night.
Thank you all for your help.

A:

Thank you Askarali you sent me down the right path, the code below is what was needed to get the desired result with out getting a corrupt heap exception. Thank you
void main()
{
    char* strFile;

    strFile = new char[50];

    // Get the file path
    strcpy(strFile, GetFileInputFromUser());
}

