can't copy data from heap location

xrstokes wrote on Thursday, August 15, 2019:

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

small_piece = f_gets((TCHAR*)readBuf, 100, &fil);

small_piece now points to some memory on the heap “0x20002000 <ucHeap+7656> “test\n””
when i try to copy test\n 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.

rtel wrote on Thursday, August 15, 2019:

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.

xrstokes wrote on Thursday, August 15, 2019:

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