View Single Post
Old 05-31-2005, 04:40 AM   #1 (permalink)
OzOz
Psycho
 
Location: Right here, right now.
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.
OzOz is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76