I have to say I do not really understand the problem. I am using a linux machine.
I have copied you code, changed the system command and compiled it. Everything went ok. I ran it with option 1 and everything went ok HOWEVER it created a file with no name in the directory where I am running the program. This means that whatever your path is it is not getting it correctly and that is true because you create the file by fopen and you give it an empty buffer.
I changed that to a static path and everything works perfectly. Here is the code that I could compile and run correctly ( no big changes at all ).
#include<stdio.h>
#include<stdlib.h>
void saveem()
{
char buffer2[20];
char buffer[80];
FILE *fp;
fp=fopen("/home/rida/test.txt", "a");
fgets(buffer, 80, stdin);
fprintf(fp, "%s", buffer);
fclose(fp);
}
void deleteem()
{
system("rm /home/rida/test.txt");
}
int main()
{
char buffer2[20];
int input;
printf("1.Write something in test.txt");
printf("\n2.Delete test.txt\n");
scanf("%d", &input );
switch (input) {
case 1:
fgets(buffer2, 30, stdin);
saveem();
break;
case 2:
deleteem();
break;
default:
printf(" Bad input, Quitting!\n");
break;
}
getchar();
return 0;
}