AnsweredAssumed Answered

How to Modify text file in USB host mode

Question asked by aslam.waleed on Aug 9, 2012
Latest reply on Aug 9, 2012 by Clive One
does anyone have idea how to modify a text file in usb host mode using Fatfs library. 
I have a working project of usb host and successfully writing a new file using the code below. but i dont have the idea how to modify or append info in already existing file.

/* Register work area for logical drives */
    f_mount(0, &fatfs);
    if(f_open(&file, "0:STM32.TXT",FA_CREATE_ALWAYS | FA_WRITE) == FR_OK)
      /* Write buffer to file */
      bytesToWrite = sizeof(writeTextBuff); 
      res= f_write (&file, writeTextBuff, bytesToWrite, (void *)&bytesWritten);   
      if((bytesWritten == 0) || (res != FR_OK)) /*EOF or Error*/
        USART2_SendData_s("> STM32.TXT CANNOT be writen.\n");
        USART2_SendData_s("> 'STM32.TXT' file created\n");
      /*close file and filesystem*/