lundi 30 mars 2015

How to create a file on system drive on windows 8.1 in c?

Take a look at the code below, it works for drive d but not for c (system drive) - I guess it's because of some security restrictions but how to bypass them?



#include <stdio.h>

main()
{
FILE *fp;

fp = fopen("c:\\test.txt", "w+");
fprintf(fp, "This is testing for fprintf...\n");
fputs("This is testing for fputs...\n", fp);
fclose(fp);
}

Aucun commentaire:

Enregistrer un commentaire