Is there a way to get to know if a file is opened by a process?
In the standard C library, there isn't even such a thing as a "process".
Information about open files is operating system dependant. You will
need to ask your question in a newsgroup or mailing list specific to
your OS.
Note: your question is ambiguous and can be interpreted in at least
three ways. When you ask in the other newsgroup, you should be more
specific:
A) Is there at least one file that a specific process XYZ has open?
(For some particular definition of 'file' -- e.g., are you including
devices?)
B) Does specific process XYZ have specific file ABC open?
C) Is there some process which has specific file ABC open?
Note: if your operating system of interest is derived from Windows NT
then I suggest you check out the programs from sysinternals.com
(a wholely owned Microsoft division.)