whenever I want to run a c program as admin in windows, I will right click the program and click run as administrator without this manual , can I compile the c code to ask the user for admin privileges like most of other application.
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
int main()
{
FILE* fp;
fp=fopen("c:/TEXT.c","w");
if(fp==NULL)
{
perror("FILE ERROR");
exit(1);
}
printf("Sucessfully file created");
getch();
return 0;
}
output:(non admin)
FILE ERROR: Permission denied
--------------------------------
Process exited after 0.04759 seconds with return value 1
Press any key to continue . . .
output:(as admin)
Sucessfully file created