Weird fopen problem in C++ - help?
I've been writing a program and have found a weird problem on my PC. I traced it to a call to fopen, which for some strange reason has suddenly become extremely selective about which files it chooses to see. I tried writing a tiny test app to check that I was using fopen correctly, and I still see the same problem there. The test app is very simple:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
FILE *pFile;
int i = 0;
char c;
pFile = fopen("C:\\XMLTest.txt", "r");
if(pFile)
{
c = fgetc(pFile);
fclose(pFile);
}
else
{
i = errno;
}
return 0;
}
I'm still finding that it will pick up some files, but not all. The one shown here - nothing. It's giving errno = 2, which means that the file or directory doesn't exist. I assure you, it most definitely does exist. What else could be causing this, and in such a selective manner? Anyone have any ideas? I'm clean out of them.
Thanks in advance for your help.
__________________
Maybe you should put some shorts on or something, if you wanna keep fighting evil today.
|