I need a program that can make me multiple accouts stored in different files. This is what I've done so far but for some reason ("test" + userName + ".txt", "a"); does not work. Thank you for your time!
int main() {
char choice[10];
printf("create accout (1)");
printf("\nlogin to accout (2)\n");
scanf("%s", &choice);
getchar();
if (strcmp(choice, "1") == 0)
{
char userName[1000];
FILE *myFile;
myFile = fopen("test" + userName + ".txt", "a");
if (myFile == NULL)
{
printf("file does not exist");
}
else
{
printf("Enter your username: ");
gets(userName);
fprintf(myFile, "%s", userName);
fclose(myFile);
}
}