test for disconnected map drive

I need to get the attributes of a file which resides on a mapped drive. However the users may loose the connection, so the drive may still be mapped but inaccessible. How do I test if the file can be reached g:\temp\test.dll . If the user disconnects the network cable for instance the program will hang on this block of code.

void test(void)
{
struct stat g_attr;
stat("G:\\temp\\test.dll", &g_attr);
}


Registered users can post here. Sign in or register to post.