question about PtSetResoruce&PtSetResource

I would like to achieve that after input some string in the PtText and then read this string once press a button, at last output this string to PtLabel. The callback code as follows:

char *text;
PtGetResource(ABW_datatext_1, Pt_ARG_TEXT_STRING, &text, 0);

PtSetResource(ABW_label, Pt_ARG_TEXT_STRING, *text, 0);

return(Pt_CONTINUE);

but when I run it, once click the button, the whole window will close, problem comes from PtSetResource, but I do not know how to fix it, thank you for your help.

Try this:

PtSetResource(ABW_label, Pt_ARG_TEXT_STRING, text, 0);