File Append

#include <stdio.h>

int main() {
    // File append
    FILE *file;
    char data[] = "This text will be appended.\n";

    file = fopen("append.txt", "a");
    if (file != NULL) {
        fprintf(file, "%s", data);
        fclose(file);
        printf("Data appended to the file.\n");
    } else {
        printf("Unable to open the file.\n");
    }

    return 0;
}
chevron_left
chevron_right

Leave a comment

Your email address will not be published. Required fields are marked *

Comment
Name
Email
Website