cancel
Showing results for 
Search instead for 
Did you mean: 

Write to textfile

csutter
Associate
Posted on February 19, 2014 at 09:35

Hi 

I'm trying to write some values to a textfile but without success. I work with the IAR Workbench. Bellow the code which I found also in the Arm User Guide:

#include <stdio.h>

FILE *f; f = fopen (''Test.txt'',''r''); /* Open a file from default drive. */ if (f == NULL) { printf (''File not found!\n''); }

The error is FILE and f undefined Can anybody help me what I'm doing wrong?Regards

3 REPLIES 3
chen
Associate II
Posted on February 19, 2014 at 11:04

Hi

''

The error is FILE and f undefined Can anybody help me what I'm doing wrong?''

You are working in an embedded environment where there is no 'file' definition as standard.

It is up to the developer to define/create the file definition.

In other words - what/where is the file stream going to be directed?

Where is the text file going to be stored (SD card, USB memory stick, NV RAM etc)

What filing system is there?

csutter
Associate
Posted on February 19, 2014 at 12:51

Hi 

Ok thanks for your answer. I was wrong with my thinking:)

regards

Andrew Neil
Evangelist
Posted on February 20, 2014 at 20:33

''I was wrong with my thinking''

Yes - but all is not lost!

There are plenty of examples of using file systems on microcontrollers; eg, with SD Cards.

However, you might do well to start with some more basic, entry-level projects...