Writting an array into SD card using fatfs( sdio)

Thread Starter

ashokraj

Joined Feb 1, 2018
151
Hi,
I am trying to write an array of size for example uint16_t array[10000] into sd card using fatfs library using the following syntax: f_write(&myFILE, array, sizeof(array), &testByte); when ever i am trying to write using above syntax the array is not getting stored into memory card. what are the other ways in which i can store an array in sd card?
If i use above mentioned lines only ascii values are getting stored: ¹ ÿ × × Ø × × Ø
Instead if i use f_printf ( loop for array ) i can able to write data into memory card.

My concern is with f_printf i can only write one value at a time which is not what i am looking for

At the first place i cannot able to write an integer using f_write ie., x=1234 f_write(&myFILE, &x, sizeof(x), &testByte); when i use above function some random ascii values are getting stored.

Any tips/ suggestion please
 

MrChips

Joined Oct 2, 2009
34,629
You have not told us what platform you are using.

You also need to understand the difference between a binary file and a text file. The two are not interchangeable.
f_write( ) creates a binary file.
f_print( ) creates a text file.

What do you understand about binary and ASCII?
 
Top