can’t copy data from heap location

I’ve just finished some custom PCB’s with microSD cards. I’ve used the fatfs option included in cubeIDE. Reading a single line is fine. what i’m trying todo is read multiple lines into a character pointer or array. The problem i have is when i call ~~~ smallpiece = fgets((TCHAR*)readBuf, 100, &fil); ~~~ small_piece now points to some memory on the heap “0x20002000 <ucHeap+7656> “testn”” when i try to copy testn onto some memory on the stack so i can read the next line, neither ~~~ memcpy( tmp, small_piece, 6 ); //<—Doesn’t work? strcpy( tmp, small_piece ); //<—Doesn’t work either? ~~~ see the attached pic. I’m new to this so I might be missing something really basic. Thanks in advance.

can’t copy data from heap location

Preference is to keep this support forum specifically as a resource for FreeRTOS questions, rather than general programming or embedded questions. As your question relates to software obtained from ST, and does not appear to be related to FreeRTOS, I recommend you post to the ST forum – thanks.

can’t copy data from heap location

No worries, I haven’t needed help for this project before and had no idea where to start. Thanks anyway. For any who come looking I think it’s here. https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus