File already exists
Hi and thanks in advance for reply.
My question is I'm writing a C program on Red hat 9 using Unix, and want to open a file for writting, i'm checking to see if file already exists, if it does i want to prompt the user if they want to over write or give new file a new name, if they want to over write no probs.
If they don't want to over write i want them to input a new file name and assign new file name to the file open command.
What would be nice is for the user to input name store in a variable and use the variable in the file open command. i.e. fgets(name,30, stdin);
fp = fopen("name", "w");
Then i can use this variable again if wanted.
Or any other ideas would be appreciated