2018-10-11 06:27 PM
I am referring to FATFS library
1.I tried to use \n and \t it didnt work. i wanted to make text appear in a new line.
2. in the memory card i wanted to store a vairable integer, How can i do that? As of now i could able to save only character.
In FATFS is there any other way i can save data apart from .txt file?
Solved! Go to Solution.
2018-10-11 08:08 PM
How do you normally do file IO with STDIO functions? FATFS is pretty similar.
Use \r\n
int x = 1234;
f_write(&fil, &x, sizeof(x), &byteswritten); // pretty inefficient
>>In FATFS is there any other way i can save data apart from .txt file?
f_write() writes binary data, it doesn't know you're using a text file.
Name files how you want.
Write the content you want.
2018-10-11 08:08 PM
How do you normally do file IO with STDIO functions? FATFS is pretty similar.
Use \r\n
int x = 1234;
f_write(&fil, &x, sizeof(x), &byteswritten); // pretty inefficient
>>In FATFS is there any other way i can save data apart from .txt file?
f_write() writes binary data, it doesn't know you're using a text file.
Name files how you want.
Write the content you want.
2018-10-24 02:22 PM
@Community member , i have exactly used the above mentioned lines. I have got the output as below;
Ò
I tried to output to .txt file and .binary file. the same issue. Any suggestions please
2018-10-24 03:21 PM
File content does not depend on the naming.
Files are a collection of bytes.
Data stored in a native binary form does not appear in human readable ASCII.
Use a file viewer or hex editor to review the content of a file.
2018-10-25 06:03 AM
if i write the following:
char myData [] = " hello ashok\0";
f_write(&myFILE, myData, sizeof(myData), &testByte);
The output of the above is:
hello ashok.
How can it differ from characther to numbers
2018-10-25 08:46 AM
Certainly indicative of a problem at the SDIO or FATFS levels.