The analyzer has detected a potential error that occurs when calling a function intended to handle files. An absolute path to a file or directory is passed into a function in one of the actual arguments. Using a function in such a way is dangerous, as there may be cases that this path doesn't exist on the user's computer.
Consider an example of incorrect code:
FILE *text = fopen("c:\\TEMP\\text.txt", "r");
A better way is to get the path to a file on certain conditions.
This is the correct code:
string fullFilePath = GetFilePath() + "text.txt";
FILE *text = fopen(fullFilePath.c_str(), "r");
This diagnostic is classified as:
You can look at examples of errors detected by the V631 diagnostic. |