December 26th, 2013, 01:37 PM
Confused about TXT file line-feed
I'm wanting to make a txt file, using C, and written to an SD card, consisting of a single long column.
The character I'm writing to that column is defined here:
data_str= ','; //comma delineator
data_str= a + '0';
data_str= b + '0';
data_str= c + '0';
data_str= '\\' ;
data_str= 'r'; //carriage return
data_str= 'n'; // line feed
a comma delineator followed by three BCD digits followed by a "carriage return" and a "line feed"
then I do:
FSfwrite (data_str, 1, 8, pointer);
which creates a TXT file on the SD card looking like this:
,309\r\n,327\r\n,327\r\n,310\r\n,333\r\n,327\r\n,317\r\n,341\r\n,329\r\n,326\r\n,348\r\n,330\r\n,331 \r\n,345\r\n,322\r\n,328\r\n ... and so on
when what I wanted was this
and so on.
obviously the text reader (Windows notepad) is not responding to the \r\n command - it's simply printing it out.
What am I doing wrong please?
December 26th, 2013, 01:47 PM
and write 6 bytes instead of 8.
data_str= '\r' ;
December 26th, 2013, 03:21 PM
Thank you Salem! It works perfectly now.