2460 views|2 replies

15

Posts

0

Resources
The OP

How to continue writing in the file content in SD? [Copy link]

Use FATFS to write a file to the SD card, for example, WR.txt, the content is "THIS IS APPLE", if you want to continue writing "THIS IS APPLE" in this file, how should you operate? ? ? fresult = f_open(&g_sFileObject, g_cCmdBuf, FA_READ | FA_CREATE_ALWAYS | FA_WRITE); f_sync (&g_sFileObject); if(fresult == FR_OK) { UARTprintf("\n\f_open is ok\n"); fresult = f_write (&g_sFileObject, buf1, sizeof (buf1) - 1, &bytesWritten); f_sync (&g_sFileObject); if(fresult == FR_OK) { UARTprintf("\n\f_write is ok\n"); UARTprintf("%d\n",bytesWritten); } else { UARTprintf("\n\f_write is fail\n"); } } else { UARTprintf("\n\f_open is fail\n"); }
This post is from Microcontroller MCU

Latest reply

1. FA_CREATE_ALWAYS is not required. 2. After opening the file, move the file pointer to the end and then write.  Details Published on 2012-11-27 20:09

1991

Posts

24

Resources
2
1. FA_CREATE_ALWAYS is not required. 2. After opening the file, move the file pointer to the end and then write.
This post is from Microcontroller MCU

15

Posts

0

Resources
3
Which parameter does the file pointer refer to? ? ?
Found it, it is g_sFileObject.fptr. [ This post was last edited by sun9091 on 2012-11-28 09:19 ]
This post is from Microcontroller MCU

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

    EEWorld
    subscription
    account

    EEWorld
    service
    account

    Automotive
    development
    circle

    Robot
    development
    community

    About Us Customer Service Contact Information Datasheet Sitemap LatestNews

    Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190

    Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
    快速回复 返回顶部 Return list