Hi, I am writing to a file (.TXT) in a USB flash memory. I can write to the file, however, I dont know how to jump to next line. I have tried this:
i = sprintf(buf,"%d-%d-%d %d:%d Puerta %d \n",dia, mes, year, hora, minuto, puerta);
write(fd, buf, i);
and some other ways with the same outcome. The outcome is the file with the information I want to write but instead of jumping to next line, a little square appears as the \n.
Anyone knows why is this happening or knows how to jump to next line?
Thanks in advance.
Solved! Go to Solution.
You can try these:
1) use "\r\n" instead of only "\n"
2) use different application (notepad, wordpad, or visual studio etc) to open the result .txt file
( some applications need to be configured to show \n as New-Line)
Regards,
You can try these:
1) use "\r\n" instead of only "\n"
2) use different application (notepad, wordpad, or visual studio etc) to open the result .txt file
( some applications need to be configured to show \n as New-Line)
Regards,
I used \n only and open the file with Microsoft Excel since I am using a .CSV file. It jump to next line using \n . When it didnt work I was only testing with notepad.
Also note that there is a flag that can automatically append line ends with line feeds for your stream (I think its in config.h). stdout has this flag set by default in all the MQX releases, the other two comm's ports do not have this flag set. You can also set this flag using ioctl.