Dynamically enumerating the members of a C++ struct
In C++ there is a struct with the following structure:
After some computations on the values of the struct members are inserted into a database table:
Given that the members of the struct can change, as well as currently close to 100 members, we are looking for a way to loop over the members in a dynamic fashion, without having to spell out each member individually.
Therefore the question is, is there a way to loop over the struct members so that the SQL that comes after the VALUES clause is updated based on however many struct members there are?
I receive an integer as argument for a function.
within function definition i want it to be of type struct tm.
eg..
main()
{
int a;
......
}
function(...,..,a,..)
int a;
{
struct tm tm;
if(!a)
^ time(&a);
^ ... (4 Replies)
I am trying to enumerate all hardware (plugged in devices) and I am using lshal source code from here:
Cross Reference: /onnv/onnv-gate/usr/src/cmd/hal/tools/lshal.c
and is missing information about plugged in monitors, and mouse and houppgae TV card. They came out in gnome device manager,... (0 Replies)
Hi,
I am working on gcov.Meaning, analysing the functionality of gcov. There is one structure called "struct bb". I am not sure, how struct bb members are getting assigned values. If anyone knows how it is happening pls let me know.
Thanks in advance.
--Vichu (0 Replies)
Can someone tell me how to do this?
Just a thought that entered my mind when learning about structs.
First thought was:
struct one
{
struct two;
}
struct two
{
three;
}
one->two->three
would this be how you would access "three"? (1 Reply)
In a well-known book on the C language, there is an example of an efficient method for using a struct member as an argument to a function. (I'm a C noob, but I believe the correct terminology might be: use call-by-reference instead of call-by-value.) The function is printf.
Anyway, here's a... (5 Replies)
Hi,
I have received an application that stores some properties in a file. The existing struct looks like this:
struct TData
{
UINT uSizeIncludingStrings;
// copy of Telnet data struct
UINT uSize;
// basic properties:
TCHAR szHost; //defined in Sshconfig
UINT iPortNr;
TCHAR... (2 Replies)
I have many headers with huge amount of structures in them, typical one looks like this:
$ cat a.h
struct Rec1 {
int f1;
int f2;
};
struct Rec2 {
char r1;
char r2;
};
struct Rec3 {
int f1;
float k1;
float ... (6 Replies)