End Google Ads 201810 - BS.net 01 --> Hi,

I have a use case to validate an path that is given as an input to my application.

I tried to create a file in the path with fopen and added the following check :

FILE *fp= fopen(Input path, "w");
if( fp == NULL)
{
//Invalid path
}
else
{
//Valid path
}

This works well for cases when the input path is invalid or not present.
But in certain cases, when UAC is enabled, a file cannot be created in the C:\Program files ********. So in that scenario, if my input path is C:\Program files, fopen doesnt return any error and above code executes the else part, which is wrong.

Can anyone please provide suggestions about this issue?


Sindhu