Jump to content
munny

Writing to a file

Recommended Posts

Hello,

I'm trying to write to a file and then reading back from it. I'm using code composer studio. After execution, I can see a file is created but nothing is written in it (Didn't get any error). Below is the code. What is the possible issue here? I omit the reading part as I couldn't able to write. 

#include <msp430.h>
#include <stdio.h>


void main()
{
    WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT

    FILE *fread;
    fread= fopen("testing", "w");  // not sure if I should add the file extention here like testing.txt but I tried including the extension also
    fprintf(fp, "Writing\n");
    fclose(fp);

}

 

Thanks,

Row

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×