Skip to main content
Graduate II
September 10, 2024
Question

use std::fstream for SDCARD

  • September 10, 2024
  • 1 reply
  • 1419 views

Hi 

I'm trying to reuse some code that uses use std::fstream for file access.

I have the FATFS working and can read and write files. like this:

fr = f_open(&fil, path, FA_WRITE | FA_CREATE_ALWAYS);

if (fr == FR_OK) {

// Write text to the file

fr = f_write(&fil, text, strlen(text), &bw);

 

Is it possible to get std::fstream to work in this environment?

Or is it just too much hassle?

 

Kristian Vang

 

 

 

 

 

    This topic has been closed for replies.

    1 reply

    KvangAuthor
    Graduate II
    September 12, 2024

    Hi 

    I'm trying to reuse some code that uses use std::fstream for file access.

    I have the FATFS working and can read and write files. like this:

    fr = f_open(&fil, path, FA_WRITE | FA_CREATE_ALWAYS);

    if (fr == FR_OK) {

    // Write text to the file

    fr = f_write(&fil, text, strlen(text), &bw);

     

    Is it possible to get std::fstream to work in this environment?

    Or is it just too much hassle?

     

    Kristian Vang