Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to access a struct within a struct? Post 302412118 by unbelievable21 on Sunday 11th of April 2010 08:49:02 PM
Old 04-11-2010
How to access a struct within a struct?

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"?
 

10 More Discussions You Might Find Interesting

1. Programming

Struct Initialization

Hi We are using a code generator for initializing structures with the #define macro. Compiling it with the GCC 2.8.1 (with -ansi) it OK. But when we are using the SUN C 5.0 compiler it screams. Following is a code sample: #include <stdlib.h> #include <stdio.h> typedef struct TEST3 {... (4 Replies)
Discussion started by: amatsaka
4 Replies

2. Programming

save a struct

hi all , can i save a structure in c in a file? how ? help me , thx. :) (2 Replies)
Discussion started by: kall_ANSI
2 Replies

3. Programming

struct tm problem

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)
Discussion started by: bankpro
4 Replies

4. Programming

Struct Array

in my .c file i have a struct atop of the program defined as follows: #define MAX 10 int curtab; static struct tab { int count; int use; } tab; with the initial function following it like so: int tab_create(int init_count) { int i; for(i=0; i < MAX; i++) {... (1 Reply)
Discussion started by: micmac700
1 Replies

5. Linux

GCOV : struct bb

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)
Discussion started by: Vichu
0 Replies

6. Homework & Coursework Questions

Passing pointers to struct

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)
Discussion started by: ignatius3
2 Replies

7. Programming

help with struct command in C

in C i am using this code to get the c time or a time or m time struct dirent *dir; struct stat my; stat(what, &my); thetime = my.st_ctime; How can i check if i have permission to check the c time of the file? (1 Reply)
Discussion started by: omega666
1 Replies

8. UNIX for Dummies Questions & Answers

struct winsize

what is struct winsize used for? i tried looking it up, but no luck. (0 Replies)
Discussion started by: l flipboi l
0 Replies

9. Programming

Storing C++-struct in file - problem when adding new item in struct

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)
Discussion started by: Powerponken
2 Replies

10. Programming

Get struct definition

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)
Discussion started by: migurus
6 Replies
libauth(3)						    InterNetNews Documentation							libauth(3)

NAME
libauth - routines for writing nnrpd resolvers and authenticators SYNOPSIS
#include "libauth.h" struct res_info { struct sockaddr *client; struct sockaddr *local; char *clienthostname; }; struct auth_info { char *username; char *password; }; struct auth_info *get_auth_info(FILE *); struct res_info *get_res_info (FILE *); void free_auth_info(struct auth_info*); void free_res_info (struct res_info*); DESCRIPTION
These functions provide a convenient C frontend to the nnrpd external authentication interface documented in doc/external-auth. Use of this library is not required; in particular, external resolvers and authenticators written in languages other than C will need to implement the necessary functionality themselves. The get_auth_info() and get_res_info() functions allocate sufficient memory for a struct auth_info or struct res_info and any necessary fields, and return a pointer to the struct with the fields filled in from information supplied by nnrpd (the FILE* parameter generally should be "stdin"). Both functions return NULL on error. The caller is responsible for deallocating the memory by using the functions below. The string fields of both structs are straightforward. The client and local fields of struct res_info actually point to instances of struct sockaddr_in (or struct sockaddr_in6 if IPv6 support is compiled in). The free_auth_info() and free_res_info() functions free the struct passed in as argument and all necessary fields. BUGS
In many cases, nnrpd provides more information than is normally useful (for example, even when calling an authenticator, the resolver information is often provided.) On the other hand, in certain cases it provides less information than might be expected (for example, if nnrpd is reading from stdin rather than a socket). The implementation is capable of handling at least the first of these issues, but that functionality is not exposed in the interface. At present, libauth.h and its implementation are located in authprogs/; perhaps they should be moved to include/ and lib/, respectively? HISTORY
Written by Jeffrey M. Vinocur <jeff@litech.org> for InterNetNews. $Id: libauth.pod 8200 2008-11-30 13:31:30Z iulius $ SEE ALSO
nnrpd(8), readers.conf(5), doc/external-auth INN 2.5.2 2009-05-21 libauth(3)
All times are GMT -4. The time now is 03:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy