473,473 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to get structure elements?

hi everyone sorry for the stupid question but I can't figure it out how
I can get elements of a structure?
example I want to get all the elements in the structure which I don't
know?
I am trying to find out where are inode_t, FILE and DIR structures but
I can find them?
thanks for your help in advanced

Nov 14 '05 #1
4 1723
Didn't get your question! Are you asking about the data types inode_t?
Have you checked in the relevant header (.h) files?

Nov 14 '05 #2
k3rb wrote:
hi everyone sorry for the stupid question but I can't figure it out how
I can get elements of a structure?
example I want to get all the elements in the structure which I don't
know?
I am trying to find out where are inode_t, FILE and DIR structures but
I can find them?
thanks for your help in advanced

inode_t and DIR structures are not standard C. The pointer to FILE is,
but the type is intended to be opaque. There is nothing in a FILE
struct that can be assumed to be portable; it is completely
implementation-specific. If you want to play the dangerous game of
looking inside those black boxes, you may want to look to
system-specific headers. On the implementation I use most often, the
struct FILE is defined in <stdio.h>, but this is not guaranteed. On the
other hand, the non-standard struct DIR is *not* defined in the
non-standard header <dirent.h>; what is there is a typedef to a library
internal struct. The source for that internal struct is available, but
that need not be true. If you *really* need this kind of information --
think carefully before saying 'yes' -- ask in a newsgroup for your
implementation.
Nov 14 '05 #3
"k3rb" <ke****@gmail.com> wrote:
# hi everyone sorry for the stupid question but I can't figure it out how
# I can get elements of a structure?

You can't do it within the language: C doesn't support that kind of introspection.

# example I want to get all the elements in the structure which I don't
# know?
# I am trying to find out where are inode_t, FILE and DIR structures but
# I can find them?
# thanks for your help in advanced

Depends on the implementation and operating system.
You might be able to do something like

echo '#include <stdio.h>' > /tmp/x.c
cc -E /tmp/x.c >x.i
grep -B 100 '} FILE' x.i

--
SM Ryan http://www.rawbw.com/~wyrmwif/
I love the smell of commerce in the morning.
Nov 14 '05 #4
thanks SM Ryan that is exactly what I need.

Nov 14 '05 #5

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

Similar topics

0
by: Karl Smith | last post by:
Headless <invalid_address@dna.ie> wrote in reply to Christoph Paeper <crissov@gmx.net>: > Semantically <span>this</span> is 100% identical to: > Semantically <div>this</div> is 100% identical...
11
by: Mannequin* | last post by:
Hi all, I'm working on a quick program to bring the Bible into memory from a text file. Anyway, I have three questions to ask. First, is my implementation of malloc () correct in the program to...
2
by: bluekarthik | last post by:
hi, In simple words 'How to view / Read the various elements values in a structure at a particular point of my DRV ?' The Story is ->>>> i am using softice for tracking/hunting a bug . I am...
3
by: Leo Nunez | last post by:
Hello! I need copy from structure "A" to "B" that contains "strings" in a one line code. Me problem like this : typedef struct tHeader{ char field1; char field2; char field3;
5
by: Alfonso Morra | last post by:
Hi, I am writing a messaging library which will allow me to send a generic message structure with custom "payloads". In many cases, a message must store a non-linear data structure (i.e....
10
by: Duncan M Gunn | last post by:
Hi, I need to store the following matrix of values: T U V A 2 1 1 B 2 - - C - - 2 Where (-) is an empty cell.
14
by: zoltan | last post by:
Hi, Consider a structure as follows : struct dummy { int a; int b; int c; };
1
by: CptDondo | last post by:
I have a structure that looks like this: struct parameterSchedule_t { uint16_t waterFlow, uint16_t timerBase, uint16_t safetyDelay, uint16_t pressureRiseTimer, uint16_t stallTimer, uint8_t...
4
by: rushik | last post by:
Hello all, I am using structure in my program, and my aim is to sort this structure based on some optimized sorting algo. structure is struct data { int account;
0
by: MikeCS | last post by:
Hi all I would like some help with this issue. I am new to VB 2005 (OK with VB6) My problem is that I cannot seem to return a structure from a function. Example: I defined a structure in a...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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.