problem with data stortage in the MFS

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

problem with data stortage in the MFS

654件の閲覧回数
botaoyang
Contributor II

I want to save some data(Integer data and float data) to SD card using MFS, but the example program (write(fd,buffer,strlen(buffer));) can only save string data, I want to know how to

using the write command to save a variable data in the form of decimal.

thank you!

0 件の賞賛
返信
1 返信

565件の閲覧回数
RadekS
NXP Employee
NXP Employee

Hi Botao,

It depends in which format you want to store these data.

If you want that data could be readable in different system (like PC). You should probably use string form. In this case for example sprinf() function.

sprintf(buffer, "Value of Pi = %f", pi_number);

write(fd,buffer,strlen(buffer));

If you want store numbers directly you can try using for example such case:

uint32_t                              usr_data[10];

len = write(flash_file, usr_data, sizeof(usr_data));

I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信