I have a problem printing my string using PDcurses. Compiler shows no error, but when I open my program it immediately stops working. When I print it using cout it works normally.
main.cpp
#include "Item.h"
#include "Character.h"
#include "Inventory.h"
#include<iostream>
#include <curses.h>
using namespace std;
int col = 0;
int row = 0;
int main() {
    Character player("Roland", 1, 500, 200, "Knight");
    char* playerChar = (char*)alloca(player.drawCharacter().size() +1);
    memcpy(playerChar, player.drawCharacter().c_str(), player.drawCharacter().size() + 1);
    //cout << playerChar;
    //playerChar = "dasdasdasdsadasdsadsad";
    initscr();
    getmaxyx(stdscr, row, col);
    mvprintw(6,6,playerChar);
    getch();
    endwin();
    return 0;
}
my function
string Character::drawCharacter() {
    ifstream file ("Character/Knight_axe.txt");             //Open file
    string lines = "";                                  //Store all lines
    if (file){                                          //Check if everything is good
        while (file.good ()){
        string TempLine;                                //Temp line
        getline (file , TempLine);                      //Get temp line
        TempLine += "\n";                               //Add newline character
        lines += TempLine;                              //Add newline
        }
    } else {
        lines = "ERROR File does not exist.";           //Return error
    }
    file.close ();                                      //Close file
    return lines;                                       //Print it to the screen
}
