I am trying to generate a log file by invoking the function "fopen()" in keil for samsung S3FS92G target though i m getting the result in serial window but finally needs to log in txt or xml file. Even though I am not getting any compilation error (like fopen() missing) but the log file is not created at the expected system path. any help on generating a txt file using fopen
no file is getting created at all at any location, Its returning NULL value if((fp=fopen("record.txt","w"))==NULL) { printf("cannot open file"); exit(1); }
this part is just printing cannot open file on serial window
Note: i dont have keil FlashFS library
Hi,
the ARM Std. C Library provide STDIO functions. You need to add a proper target-dependent low-level implementation! Semihosting is not supported in MDK-ARM so it must be switched off: http://www.keil.com/support/man/docs/armlib/armlib_ciheeaja.htm
The low-level stub functions from the ARM Std. Library are explained here: http://www.keil.com/support/man/docs/armlib/armlib_cihefhge.htm
Furthermore, this will not work if you have MircoLib enabled in uVision Options for Target -> Use MicroLib!
Regards, Alex
Anyway, you need some Middle-Ware which provide low-level file system access like to SD-Cards. Take a look to RL-ARMs FlashFS here http://www.keil.com/rl-arm/rl-flash.asp
BR, Alex
i have used low level API means i have written IO retargeting function thats why printf is working as well as for STDIN STDOUT STDERR fopen but i dont know where the output is getting stored in when i am using STDERR in fprintf() and then i used fopen which is returning NULL.
Basically my ultimate goal is to store serial window output in a text file