Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 22218

Cannot write to a .txt file

$
0
0

I am using MSP-EXP430F5529LP.

#include <stdio.h>

int main()

{

    /*--------------------------*/
    _u8   voltage = 240;      
    _u8   current=10; 
    _u16   power = 2400; 
    /*----------------------------*/
    FILE *f = fopen("myfile.txt", "w");
    if (f == NULL)
    {
    printf("Error opening file!\n");
    exit(1);
    }

  /* print integers and floats */
  fprintf(f, "Integer: %d", voltage);
  fprintf(f, "Integer: %d", current);
  fprintf(f, "Integer: %d", power);       
  fclose(f);
  /*-------------------------------*/
}

I keep getting the 'ERROR opening file' but as far as I know it should just make a new file with the name myfile.txt.

EDIT: I now realise the MSP has no file system so wont work (if I am correct)

Hopefully someone can think of a solution then....

I am using the MSP with CC3100MOD in AP-MODE....I am wanting to update variables on the clients web browser.

How do I update the html files?....

Any help would be appreciated.

Regards

Jack


Viewing all articles
Browse latest Browse all 22218

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>