So, i'm new to coding in general and i'm learning C, i'm trying to make a program that executes an action according to the number the person types in (For example type 1 to open the browser), and i'm having some trouble with the notepad part. The notepad consists in: you will be able to write anything, and when you press enter it's gonna save it as a txt file. Now the problem: when i execute the code, i can't write when i was suppose to, but yeah, it creates the txt file but without nothing because i couldnt type.
Btw i copy pasted the notepad code into an empty C file and it worked fine
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#define DATA_SIZE 1000
int main()
{
    char data[DATA_SIZE];
    int selection = 0;
    printf("\t\t\t\t\HELLO, WELCOME TO THE ACTION CENTER\n");
    printf("Select what you want by typing the number according to the list below\n");
    printf("\t1. Type something on notepad\n");
    printf("\t2. Open browser\n");
    printf("\t3. Open Zoom\n");
    scanf("%i", &selection);
    //char data[DATA_SIZE];
    if (selection == 1)
    {
        //char data[DATA_SIZE];
        printf("Opening Notepad...\n");
        FILE * fPtr;
        fPtr = fopen("txtfiles/text1.txt", "w"); // it needs to be in the same folder as your code 
        if (fPtr == NULL)
        {
            printf("Unable to create your txt file\n");
            exit(EXIT_FAILURE);
        }
        printf("NOTEPAD - TYPE WHAT YOU WANT:\n");
        fgets(data, DATA_SIZE,stdin);
        fputs (data, fPtr);
        fclose(fPtr);
        printf("File created successfully.\n");
    }
    if (selection == 2)
    {
        ShellExecute(NULL, "open", "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe" , NULL, NULL, SW_SHOWDEFAULT);
    }
    return 0;
}
 
     
    