This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

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