Hi, All
If i need to
Template is here:
Planned to use sub "save_csv_line"
If i need to
- generate string var NewLine = "yyyyMMdd_HHmm;column_0_value;column_1_value;column_2_value;" dynamically, length is variable
- generate string var FileName = "log_yyyyMMdd_HHmm.csv" dynamically, length is fixed
- and pass them both to inline C++ sub (only this way works OK, B4R way does not work). Actually - save this NewLine into a text FileName on an SD-card.
Template is here:
B4X:
#if C
#include "FS.h"
#include "SD.h"
#include "SPI.h"
void appendFile(fs::FS &fs, const char *path, const char *message) {
Serial.printf("Appending to file: %s\n", path);
File file = fs.open(path, FILE_APPEND);
if (!file) {
Serial.println("Failed to open file for appending");
return;
}
if (file.print(message)) {
Serial.println("Message appended");
} else {
Serial.println("Append failed");
}
file.close();
}
void save_csv_line(B4R::Object* filename_and_newline_must_be_passed){
appendFile(SD, "/hello.txt", "World!\n");
}
#End If
Planned to use sub "save_csv_line"