I wonder if there is any way to lock and unlock a file in Linux when I open a file using fopen (not open)?

Based on Stack Overflow question C fopen vs open, fopen is preferred over open.

How can I implement my own file lock (if possible) by creating and deleting lock files?

Edit
Report