fprintf not completing

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

fprintf not completing

1,440件の閲覧回数
bapoo1
Contributor I

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);

//

0 件の賞賛
返信
2 返答(返信)

1,433件の閲覧回数
converse
Senior Contributor V

Works here.

Which MCU are you using and which debug probe?

0 件の賞賛
返信

1,425件の閲覧回数
bapoo1
Contributor I

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. 

0 件の賞賛
返信