example
Code: Select all
#define random_string "foo"
char buf[100];
snprintf(buf, sizeof(buf), "/sdcard/%s.txt", random_string);
FILE *f = fopen(buf, "w");
Also i can only save .txt file, no other file extensions.
also have problem, that sometimes this is working, sometimes not. example
Code: Select all
#define random_string "foo"
char buf[100];
printfs("printf statement should come soon..."); //but it won't - only this message appears, thats it, nothing else
snprintf(buf, sizeof(buf), "/sdcard/%s.txt", random_string);
printf("%s", buf);
FILE *f = fopen(buf, "w");
Code: Select all
printf("/sdcard/file.txt", buf);
FILE *f = fopen("/sdcard/file.txt", "w");
if (f == NULL) {
ESP_LOGE(TAG, "Failed to open file for writing");
return;
}
ESP_LOGI(TAG, "opening success");
fclose(f);