Hi all,
I have been trying to simply write some data to a file using the semihost and corresponding redlib libraries. Below is the code I am using - I can create the file in the correct directory, however, it just stalls when it gets to fprintf. I've read a few posts here saying that the issue is normally not using the semihost-compatible C libraries, but I've made this fix and cannot get the fprintf function to work. Can someone please help?
//
FILE *fp = fopen("C:\\Users\\BApoo\\Desktop\\Test.txt","w");
if(fp == NULL)
{
printf("Error opening file!\n");
exit(1);
}
const char *text = "This is a string which is written to a file.";
fprintf(fp, "%s\n", text);
fflush(fp);
fclose(fp);
//
Works here.
Which MCU are you using and which debug probe?
Thank you for your prompt response.
I am using the QN9080SIP with a SEGGER J-link probe. If it is of any use, I am using a Keil ULINK 2 Debug Adapter to talk with the MCU over SWD.