I am working on old C/C++ code someone in my company wrote for Linux. The code opens a file using fopen() and then locks the file using flock():
FILE *fp=fopen("text.txt", "wt");
flock( fp, LOCK_EX );
The problem is that when I compile the code using Eclipse on Linux, the compiler throws an error:
invalid conversion from ‘FILE*’ {aka ‘_IO_FILE*’} to ‘int’
flock() obviously takes an int as the 1st parameter.
What function can I use to convert "FILE *" into int?