I have been going through header files and I'm not able to find any file with status flag definitions (like O_RDONLY).
Thanks, John
I have been going through header files and I'm not able to find any file with status flag definitions (like O_RDONLY).
Thanks, John
Summary
If you're on Linux, it should be in
/usr/include/bits/fcntl.h
.You can find it using
rgrep
, orctags
andVim
, orcpp
, orcwhere
.rgrep
The simplest way is to use
rgrep
, a.k.a.grep -R
.ctags
Or, you could run
ctags -R
in/usr/include
and then runvim -t O_WRONLY
.Or, a bit better, but more typing:
cpp
The best way I have found is using
cpp
.Assuming you have a source file called YOUR_SOURCE_FILE with the necessary
#include
s, try running:Then search for your
#define
, e.g./O_WRONLY
, then scroll up to find the first file name above it. In this case:means that
O_WRONLY
is being picked up from/usr/include/bits/fcntl.h
if you include the three header files mentioned inman fcntl
.cwhere
I have a script called
cwhere
to automate runningcpp
:Download cwhere here
If
desc
is installed, you can just type the name of the function that uses that#define
, e.g.Download desc here