exporting sensor data from STM32 to a file on pc or board memory

Hello, 

I have just starting working with embedded systems, I am currently sending sensor data from a L475 Discovery IoT node, board to turbostudio terminal and I can see the data which seems correct.

I now, want to find a way to either save the data while streaming on my pc or copy it from the terminal to a file and then I would do some processing on it.

I have used ftprintf and write functions but they don't seem to work

Could someone help?

 this is what I did last but it is not working.

fp=f_open("Issamos.csv","w+");

/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */

/* USER CODE BEGIN 3 */
temp_value = BSP_TSENSOR_ReadTemp();
int tmpInt1 = temp_value;
float tmpFrac = temp_value - tmpInt1;
int tmpInt2 = trunc(tmpFrac * 100000);
snprintf(str_tmp,100," TEMPERATURE = %d.%02d\n\r", tmpInt1, tmpInt2);
fprintf()
HAL_UART_Transmit(&huart1,( uint8_t * )str_tmp,sizeof(str_tmp),1000);
fwrite(stFWRITEr_tmp, 100, 1,fp);

fclose(fp);

as you see I am collecting the data and using snprintf to display it in true studio, but writing it to a file doesn't work