Keil Logo

Creating and writing to text file

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Author
haaris moghal
Posted
5-Apr-2019 19:16 GMT
Toolset
ARM
New! Creating and writing to text file

Hi,

Using the ARM Cortex KL25Z, I have stored the value from the board into a variable. I want to take those values and store it in a text file.

Here is the code I have tried:

FILE *f = fopen("file.txt", "w");
if (f == NULL)
{
    printf("Error opening file!\n");
    exit(1);
}


/* print integers and floats */
int i = 1;
float py = 3.1415927;
fprintf(f, "Integer: %d, float: %f\n", i, py);


fclose(f);

The problems I encounter are:

- Doesnt create a file
- Doesnt write to a file

Author
Westonsupermare Pier
Posted
5-Apr-2019 23:47 GMT
Toolset
ARM
New! RE: Creating and writing to text file

Where exactly do you expect this file to be created? On an SD card on the target? Some place unrelated to the target?

Author
haaris moghal
Posted
6-Apr-2019 00:46 GMT
Toolset
ARM
New! RE: Creating and writing to text file

I want this file to be created on the PC. Away from the KL25Z. The data I am retrieving from the micro controller is to be store in a database.
I done some research and I was told to do communication by serial from my windows pc to the KL25Z, I have no idea on how to do so.

Author
Andrew Neil
Posted
6-Apr-2019 15:02 GMT
Toolset
None
New! RE: I was told ...

So go back to whoever told you that, and get them to help you with it

Author
MyPaper Edit
Posted
17-Apr-2019 13:19 GMT
Toolset
None
New! RE: I was told ...

I am sure someone will offer some possible solutions soon. I wanted to recommend a service that saved me more than once - <a href="http://mypaperedit.com/blog/the-difference-between-abstract-and-introduction " ></a>

Next Thread | Thread List | Previous Thread Start a Thread | Settings

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.