CERT-FIO38-C
In this section:
Synopsis
A FILE object is copied.
Enabled by default
Yes
Severity/Certainty
Low/Medium

Full description
A FILE object is copied. In some C implementations, the address of a FILE object might be used to identify a stream. Using a copy of FILE object might result in unexpected behavior or a crash.
Coding standards
- CERT FIO38-C
Do not use a copy of a FILE object for input and output
Code examples
The following code example fails the check and will give a warning:
#include <stdio.h>
void example(FILE file) {
FILE my_file = file;
}
The following code example passes the check and will not give a warning about this issue:
#include <stdio.h>
void example(FILE * file_ptr) {
FILE * my_file_ptr = file_ptr;
}