473,511 Members | 17,164 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can I find the exact header file including a struct variable? eg. DIR?

hi all, I'm wondering how to locate the C header file where
defines some struct variable,macro and function.
In the MSDN, we can easily solve it by using INDEX search;
but how we can do it in the Linux environment?
I had tried man [1-8]DIR; but I found no result:)
thanks in advance!

Dec 2 '06 #1
9 2413
hankssong wrote:
hi all, I'm wondering how to locate the C header file where
defines some struct variable,macro and function.
In the MSDN, we can easily solve it by using INDEX search;
but how we can do it in the Linux environment?
I had tried man [1-8]DIR; but I found no result:)
thanks in advance!
Typically they're in /usr/include. Use cat <HEADER| grep <PATTERN>.

Ask further such questions in comp.os.linux etc.

Dec 2 '06 #2
MQ

santosh wrote:
hankssong wrote:
hi all, I'm wondering how to locate the C header file where
defines some struct variable,macro and function.
In the MSDN, we can easily solve it by using INDEX search;
but how we can do it in the Linux environment?
I had tried man [1-8]DIR; but I found no result:)
thanks in advance!

Typically they're in /usr/include. Use cat <HEADER| grep <PATTERN>.

Ask further such questions in comp.os.linux etc.
DIR is usually just a typedef for a struct. In <dirent.hon my
system:

typedef struct __dirstream DIR

If this is the case you may need to search further until you find it.
Grep the files in the include directory (use -r to recurse subdirs)

MQ.

Dec 2 '06 #3
hankssong said:
hi all, I'm wondering how to locate the C header file where
defines some struct variable,macro and function.
What you're really asking is how to find a search pattern within a corpus of
text files. This question is best asked within a group dealing with your
system's command shell, or a regular expressions group.
In the MSDN, we can easily solve it by using INDEX search;
but how we can do it in the Linux environment?
By thinking clearly and asking our question in the right place.

Consider gnu.bash or comp.os.linux.development.apps as more plausible
alternatives.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 2 '06 #4
MQ said:
DIR is usually just a typedef for a struct.
No, usually DIR is a Win32 console command asking for a directory listing.
There is a significant potential for confusion between the two terms when
you have someone coming from a Windows background to a Linux environment,
and comp.lang.c is not the best group to deal with such confusion.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 2 '06 #5
thank you for all your help
I had done some test and it seemss that the problem could be soloved ad
follows:
ctags -x -R /usr/lib/include ref
vim ref
/\<DIR\// find
ctrl + ]
^_^
"santosh дµÀ£º
"
hankssong wrote:
hi all, I'm wondering how to locate the C header file where
defines some struct variable,macro and function.
In the MSDN, we can easily solve it by using INDEX search;
but how we can do it in the Linux environment?
I had tried man [1-8]DIR; but I found no result:)
thanks in advance!

Typically they're in /usr/include. Use cat <HEADER| grep <PATTERN>.

Ask further such questions in comp.os.linux etc.
Dec 2 '06 #6
santosh wrote:
hankssong wrote:
>hi all, I'm wondering how to locate the C header file where
defines some struct variable,macro and function.
In the MSDN, we can easily solve it by using INDEX search;
but how we can do it in the Linux environment?
I had tried man [1-8]DIR; but I found no result:)
thanks in advance!

Typically they're in /usr/include. Use cat <HEADER| grep <PATTERN>.

Ask further such questions in comp.os.linux etc.
He can try "cat n869.txt | grep <PATTERN>" also. A suitable
bzipped version of N869 (the draft C99 standard) can be found at:

<http://cbfalconer.home.att.net/download/>

Another useful sequence is:

less -p<PATTERN<n869.txt

In all cases replace <PATTERNwith the string of interest.

These sequences apply to systems with the appropriate Unix flavored
utilities only. They can be made available on most systems. On
others the n869.txt is still applicable, but how to search it is up
to you.

I simply capture the whole sequence in an alias named 'cstd', so I
don't have to worry about what sort of system I am running.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Dec 2 '06 #7
MQ

Richard Heathfield wrote:
No, usually DIR is a Win32 console command asking for a directory listing.
There is a significant potential for confusion between the two terms when
you have someone coming from a Windows background to a Linux environment,
and comp.lang.c is not the best group to deal with such confusion.
I would doubt there is any confusion, as the title suggests a struct
variable named DIR, not a Win32 console command

MQ

Dec 3 '06 #8
MQ said:
>
Richard Heathfield wrote:
>No, usually DIR is a Win32 console command asking for a directory
listing. There is a significant potential for confusion between the two
terms when you have someone coming from a Windows background to a Linux
environment, and comp.lang.c is not the best group to deal with such
confusion.

I would doubt there is any confusion, as the title suggests a struct
variable named DIR, not a Win32 console command
If you read it in one way, yes. Sort of "how can I find the header
containing DIR". I do see that. But what you may have missed is that it is
also possible to read it another way (along the lines of "what am I
supposed to use to find <stuff in files>? DIR?"). And the text of the
original article suggests an operating system search technique: "we can
easily solve it by using INDEX search", which seems to me (although of
course I could be wrong) to be a reference to Microsoft's facility to
search within files - a sort of poor man's grep.

So yes, the possibility for confusion does exist, and I think he needs to
sort it out elsenet on this occasion.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 3 '06 #9
MQ

Richard Heathfield wrote:

"we can
easily solve it by using INDEX search", which seems to me (although of
course I could be wrong) to be a reference to Microsoft's facility to
search within files - a sort of poor man's grep.
IIRC from my Windows programming days, you can highlight a
type/variable in a source file and tell Vis ual C to search for its
definition.

MQ

Dec 3 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
12503
by: matthurne | last post by:
I just started learning C++ on my own...I'm using Accelerated C++. Something it hasn't explained and I keep wondering about is how header files actually work. I suspect it doesn't get into it...
60
8210
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header...
18
2723
by: John Smith | last post by:
Hi all What does the group think of the practise of including one header file from inside another? I have some legacy code where this has been done, and it creates a dependency on a module...
0
3910
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
14
22329
by: Pedro Graca | last post by:
Imagine I have a structure with a size_t member: /* foo.h */ struct foo { char const *bar; size_t barlen; }; void make_foo(struct foo *p);
26
2529
by: alberto | last post by:
Hi. Im newbie in C language. I have a binary file with many character arrays of 50 character defined as char array But in some cases, many of these 50 characters are not being used. I would...
4
2021
by: Christoph Scholtes | last post by:
Hi, I have some questions about header files: Say I have a file functions.c which contains a couple of functions. I have declared some structs in this file too. The structs are defined in...
2
4112
by: Adam Teale | last post by:
hey guys Is there a builtin/standard install method in python for retrieving or finding out an image's dimensions? A quick google found me this:...
11
2899
by: whirlwindkevin | last post by:
I saw a program source code in which a variable is defined in a header file and that header file is included in 2 different C files.When i compile and link the files no error is being thrown.How is...
0
7356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7512
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5671
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1577
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.