fprint f formatting

30 Jul 2010

I am using the cool components breakout board ( very nicely done) with an SD card to log events with an event value and time stamp .  I have been unable to find details on fprintf that will allow me to add a new line command ( line feed) after each data set when viewed in a Txt viewer ( ie notepad) .  I am looking to collect data then import into a PC to parse for final use.

 

Below is an example of desired output txt file.

temp 75F    12:24:00 7/22/2010

temp 80F      8:40:00  7/22/2010.

30 Jul 2010

Try adding a \n\r inside your quotes. Like this:

 

printf(“temp %d \n\r”,temp);

 

www.skpang.co.uk/catalog

30 Jul 2010 . Edited: 30 Jul 2010

There's a very good reference to C++ located here:

http://www.cplusplus.com/reference/

and specifically for fprintf here:

http://www.cplusplus.com/reference/clibrary/cstdio/fprintf/

30 Jul 2010 . Edited: 30 Jul 2010

Sukkin

Thanks for quick response.  I was using "\n" but was not seeing the new line as I was checking results in notepad which did not process the CR.

Thanks

Bob