ok try this:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define MAX_USERNAME_LENGTH 100
int main() {
char username[MAX_USERNAME_LENGTH];
char color[10];
FILE *fp;
printf("Welcome to OyoSoft Setup!\n");
sleep(1);
printf("Please enter a username: ");
scanf("%s", username);
fp = fopen("././home.u/sys/usrnme.txt", "w");
if (fp == NULL) {
printf("Error opening file.\n");
exit(1);
}
fprintf(fp, "%s", username);
fclose(fp);
printf("Please choose a color theme (white, blue, green, red): ");
scanf("%s", color);
fp = fopen("././home.u/sys/color.txt", "w");
if (fp == NULL) {
printf("Error opening file.\n");
exit(1);
}
fprintf(fp, "%s", color);
fclose(fp);
printf("Setup complete!\n");
return 0;
}
basically, you need a function called main
XD. You can pair it with this in shell:
cd home.u/user
cc setup.c -o output
chmod +x setup.c
./output
rm -rf output