How read/Write on FS of ESP32?

I want to write and read a file in the SPI flash memory of ESP32.
But using vfs-common I can just call
mgos_vfs_write(1, "This is Me", 15); and
mgos_vfs_open("/test.CSV", 1, 28); But I’m not able to see the file in FS of ESP32 after calling it by RPC.
I want to change that file at every call but without any RPC… Can anybody suggest me a better alternative or suggest me any update in the code?

#include "mgos.h"
#include <stdio.h>
#include <string.h>
#include "esp_vfs_fat.h"
#include "driver/sdmmc_host.h"
#include "driver/sdspi_host.h"
#include "sdmmc_cmd.h"
#include <esp_err.h>
#include "spiffs.h"
#include <errno.h>
#include "mgos_vfs.h"
#include "mgos_vfs_dev.h"
#include "mgos_vfs_internal.h"

#if CS_SPIFFS_ENABLE_ENCRYPTION
#include "esp_flash_encrypt.h"
#endif

//****SPI2 Pin Defined Here****
#define PIN_NUM_MISO 19
#define PIN_NUM_MOSI 23
#define PIN_NUM_CLK 18
#define PIN_NUM_CS 5
//****SPI2 Pin Defined Here****

//spiffs *spfs;
// u32_t addr = 0x9000;
// u32_t size = 30;
// u8_t src = 90;
// u8_t dst = 90;

void data_cb(void *arg)
{
  mgos_vfs_print_fs_info("/");
  mgos_vfs_open("/test.CSV", 1, 28);     //I guess problem with this
  mgos_vfs_write(1, "This is Me", 15);
}

enum mgos_app_init_result mgos_app_init(void)
{
  mgos_set_timer(1000, true, data_cb, NULL);
  return MGOS_APP_INIT_SUCCESS;
}

This is What I’m using (Please ignore the other includes…)

Just use fopen, fread,fwrite, fclose.

Agree with @nliviu, fopen , fread , fwrite , fclose work for me on esp32

FILE *fp = NULL;
fp = fopen("test.CSV", "w");        // Will put the file at '/'
write some stuff
fclose(fp);

Ohh that was a very simple thing…:joy:
Thankyou @nliviu and @klimbot Thankyou very much.:smiley: