fopen return NULL if the path or file can not be accessed.
FILE *in_file,copy_in_file;
infile=fopen(...);
copy_in_file = in_file; /* save it for comparison later */
if (infile == NULL)
/* file doesn't exist */
else
/* ok */
...
if (in_file == copy_in_file)
/* file is still open */
else
/* whatever */
Hope this helps!
Quote:
> Hello,
> How can I find out if a filepointer is still open?
> Thanks,
> Shridhar