Shop OBEX P1 Docs P2 Docs Learn Events
Learn library SD card question — Parallax Forums

Learn library SD card question

void run_test() {
    sd_mount(0, 1, 2, 3);

    FILE *reader = fopen("fat_test.txt", "r");
    FILE *writer = fopen("new2.txt", "w");

    while (!feof(reader))
        fputc((char) fgetc(reader), writer);

    fclose(reader);
    fclose(writer);
}

The above code should copy a file to a new file.... pretty simple. Unfortunately, when I check the resulting file from my computer, there seems to be an extra byte at the end - 0xff if I understand what gedit is showing correctly. Am I doing anything incorrectly?

Comments

Sign In or Register to comment.