Add \n to file end

This commit is contained in:
Ayan Pahwa 2019-11-23 20:43:24 +05:30
parent a0ef667a14
commit 5823f5ed04

View File

@ -73,11 +73,11 @@ static void make_empty_file(FATFS *fatfs, const char *path) {
static void make_sample_code_file(FATFS *fatfs) { static void make_sample_code_file(FATFS *fatfs) {
FIL fs; FIL fs;
UINT *char_written = 0; UINT *char_written = 0;
const byte buffer[] = "print('Hello World!')"; const byte buffer[] = "print('Hello World!')\n";
//Create or modify existing code.py file //Create or modify existing code.py file
f_open(fatfs, &fs, "/code.py", FA_WRITE | FA_CREATE_ALWAYS); f_open(fatfs, &fs, "/code.py", FA_WRITE | FA_CREATE_ALWAYS);
f_write(&fs, buffer, sizeof(buffer), char_written); f_write(&fs, buffer, sizeof(buffer) - 1, char_written);
f_close(&fs); f_close(&fs);
} }