lundi 13 avril 2015

windows fopen fails randomly with permission denied

I'm trying to read and write to files in the c drive of my computer. the fopen function fails randomly.



FILE *fp = fopen(strIn, "r");
if(fp == NULL){
printf("Error: %d (%s)\n", errno, strerror(errno));
getchar();


}


the weird thing in my case is , fopen fails randomly.sometimes succeeds and sometimes fails. cannot predict why.i'm always running it in admin mode.whether this could be windows issue? the error message it get is error-13 , permission denied. im running the code in administrator mode.i have tried calling



_chmod(outFile , _S_IREAD);


checked the return value and then called fopen.The fopen failed again.


Aucun commentaire:

Enregistrer un commentaire