add permission to save a file

#include <stdio.h>
#include <stdlib.h>

int main() {
    FILE *filePointer;
    char data[1000];

    // Open file in write mode with read/write permissions for owner
    filePointer = fopen("example.txt", "w+");

    // Check if file is successfully opened
    if (filePointer == NULL) {
        printf("Unable to create or open the file.\n");
        exit(EXIT_FAILURE);
    }

    // Input data to be written to the file
    printf("Enter data to write to the file:\n");
    fgets(data, sizeof(data), stdin);

    // Write data to the file
    fprintf(filePointer, "%s", data);

    // Close the file
    fclose(filePointer);

    printf("File saved successfully.\n");

    return 0;
}