JohnGraham: Would const be useful if the struct was as follows?
Shamrock: Many thanks.
The "kelly" struct is based on real code that works well, but I (sloppily) took it out of a reasonably complex context, where the function being called by dereferencing "lg" varies based on the program name, whether input is from stdin/file, the command line arguments, sanity checks, etc.
To understand this code, there's a fair amount of indirection to resolve. The reward if I can figure it out is that it's a workable example of how to parse an above average number of command line variations.
I am using a structure defined as follows
struct gene_square
{
double *x;
double *y;
};I have class, with a member function which is a pointer of this type:
gene_square* m_Genes;I am allocating memory in the constructors like this:
m_Genes = new gene_square;
for (ii=0;... (1 Reply)
Hi All,
My latest assignment (practice not coursework!) is to write prototype interactive exam/test console application. I've used structs to store the question information (not sure if this was the best way to do it?) and I have the following code that outputs each question and it's possible... (0 Replies)
I have two or more linked lists that have the same names for their "next". For example,
struct server_t {
sockaddr_in * sin;
server_t * next_;
}
struct player_t {
char name;
player_t * next_;
}
How can I get a function to take in either type and manipulate the pointers?
I... (3 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)
Hi, i'm trying to copy a struct into a binary file using the unix instruction write, so i declare and fill the struct "superbloque" in one function "initSB" and then i pass the pointer to another function called bwrite (for block write) which calls write. The problem is that i call the function... (2 Replies)
I am trying to work out the best syntax for a relatively simple operation. The goal is to declare an instance of a struct and pass it around to be populated and have the data manipulated. There is an extra wrinkle in that the functions are in different src files.
The main is simple,
#include... (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)
In C++ there is a struct with the following structure:
typedef struct myStruct
{
string s_date;
float fA;
float fB;
float fC;
.....
float fZ;
} myData;
After some computations on the values of the struct members are inserted into a database table:
myData... (4 Replies)
Store args passed in array but not the first 2 args.
# bash
declare -a arr=("$@")
s=$(IFS=, eval 'echo "${arr}"')
echo "$s"
output:
sh array.sh 1 2 3 4 5 6
1,2,3,4,5,6
Desired output:
sh array.sh 1 2 3 4 5 6
3,4,5,6 (2 Replies)
Discussion started by: iaav
2 Replies
LEARN ABOUT NETBSD
radio
RADIO(9) BSD Kernel Developer's Manual RADIO(9)NAME
radio -- interface between low and high level radio drivers
DESCRIPTION
The radio device driver is divided into a high level, hardware independent layer, and a low level hardware dependent layer. The interface
between these is the radio_hw_if structure.
struct radio_hw_if {
int (*open)(void *, int, int, struct lwp *);
int (*close)(void *, int, int, struct lwp *);
int (*get_info)(void *, struct radio_info *);
int (*set_info)(void *, struct radio_info *);
int (*search)(void *, int);
};
The high level radio driver attaches to the low level driver when the latter calls radio_attach_mi. This call should be
void
radio_attach_mi(rhwp, hdlp, dev)
struct radio_hw_if *rhwp;
void *hdlp;
struct device *dev;
The radio_hw_if struct is as shown above. The hdlp argument is a handle to some low level data structure. It is sent as the first argument
to all the functions in radio_hw_if when the high level driver calls them. dev is the device struct for the hardware device.
The fields of radio_hw_if are described in some more detail below.
int open (void *, int flags, int fmt, struct lwp *p);
Optional.
Is called when the radio device is opened.
Returns 0 on success, otherwise an error code.
int close (void *, int flags, int fmt, struct lwp *p);
Optional.
Is called when the radio device is closed.
Returns 0 on success, otherwise an error code.
int get_info (void *, struct radio_info *);
Fill the radio_info struct.
Returns 0 on success, otherwise an error code.
int set_info (void *, struct radio_info *);
Set values from the radio_info struct.
Returns 0 on success, otherwise an error code.
int search (void *, int);
Returns 0 on success, otherwise an error code.
SEE ALSO radio(4)BSD December 20, 2005 BSD