how to save data into file in keil IDE

hi
I want to save my intermediate data into a file.
I tried to use fopen, fwrite, it can not even read. how should i use rtl.h ?

  int  count[10];
  FILE *fout;

  fout = fopen ("Counter.bin","w");
  if (fout != NULL) {
    fwrite (&count[0], sizeof (int), 10, fout);   // write an item 10 times to the file
    fclose (fout);

my keil version 4.6
ARM core is cortex-M0.
I am using the startup_MPS_CM0.s startup file to do the work.

Thanks for help!

Parents
  • Thanks for your link. it seems like that I have to set the .ini file with creation of the exec("save") and button.

    I understand that "Embedded products normally don't have any fopen(), fread(), ... because there are normally no standard hardware available to store files."

    why could not we use potential stream functions (if not fopen, fwrite )in the simulation mode to save the data to a file? should I have to run in specific mode or use some special library?

    Keil IDE should be able to do so, theoretically, it is doable .

Reply
  • Thanks for your link. it seems like that I have to set the .ini file with creation of the exec("save") and button.

    I understand that "Embedded products normally don't have any fopen(), fread(), ... because there are normally no standard hardware available to store files."

    why could not we use potential stream functions (if not fopen, fwrite )in the simulation mode to save the data to a file? should I have to run in specific mode or use some special library?

    Keil IDE should be able to do so, theoretically, it is doable .

Children
More questions in this forum