Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   how can I find the exact header file including a struct variable? eg. DIR? (http://www.velocityreviews.com/forums/t445385-how-can-i-find-the-exact-header-file-including-a-struct-variable-eg-dir.html)

hankssong 12-02-2006 07:17 AM

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!


santosh 12-02-2006 08:46 AM

Re: how can I find the exact header file including a struct variable? eg. DIR?
 
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.


MQ 12-02-2006 08:55 AM

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

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.h> on 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.


Richard Heathfield 12-02-2006 09:01 AM

Re: how can I find the exact header file including a struct variable? eg. DIR?
 
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.

Richard Heathfield 12-02-2006 09:09 AM

Re: how can I find the exact header file including a struct variable? eg. DIR?
 
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.

hankssong 12-02-2006 09:48 AM

Re: how can I find the exact header file including a struct variable? eg. DIR?
 
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.



CBFalconer 12-02-2006 12:04 PM

Re: how can I find the exact header file including a struct variable?eg. DIR?
 
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 <PATTERN> with 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>



MQ 12-03-2006 03:00 AM

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

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


Richard Heathfield 12-03-2006 07:25 AM

Re: how can I find the exact header file including a struct variable? eg. DIR?
 
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.

MQ 12-03-2006 07:37 AM

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

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



All times are GMT. The time now is 11:32 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.