unix « struct « C Data Type Q&A

Home
C Data Type Q&A
1.binary
2.bit
3.byte
4.char
5.character
6.decimal
7.Development
8.float
9.hex
10.integer
11.prime
12.random
13.struct
C Data Type Q&A » struct » unix 

1. Why sockaddr_storage structure defined as the way it is defined?    stackoverflow.com

Below is the definition of sockaddr_storage structure (rfc2553). According rfc2553, the sockaddr_storage should be aligned with 64 bit boundary and it should be able to hold both sockaddr_in and sockaddr_in6. Also, ...

2. Unix programming. Not sure how to use the passwd struct    stackoverflow.com

I've done some research and I'm still struggling with the passwd structure. http://www.opengroup.org/onlinepubs/000095399/basedefs/pwd.h.html I need to obtain the user ID however I dont think I'm using understanding it at all. int getpwuid_r(uid_t, ...

3. Struct that apparently defines no instances in Unix v6    stackoverflow.com

I'm going through the code of Unix version 6 with the Lion's book. One of the header files (param.h, can be accessed here) defines the following structs:

/*struct to ...

4. What is the use of second structure(*oldact) in sigaction()    stackoverflow.com

I am trying to create a handler for the exit signal in c and my operating system is ubuntu. I am using sigaction method to register my custom handler method.

int sigaction(int signum, ...

5. Read and write struct with unistd.h read/write    stackoverflow.com

I'm studying UNIX programming and was experimenting with read/write system calls. I have a file with a pair of integer:

4 5
and I wrote this code to read the numbers:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include ...

6. Code compiles on AIX 5.3 but not AIX 7.1 something to do with struct shl_descriptor where is this defined?    stackoverflow.com

I have some code that looks similar to the following:

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <stdarg.h>
#include <sys/ldr.h>

int main (int argc, char **argv)
{
   int    ...

7. How Do I Store and Retrieve a Struct into a Shared Memory Area in C    stackoverflow.com

For a uni assignment I need to create a circular list of up to 10 file names, and then store these in a shared memory area, so that 2 child processes ...

8. sending a struct over UDP UNIX sockets in C    stackoverflow.com

I'm working on a client/server ftp program for a class using UNIX sockets in C. I have to send my data to this process my professor is having us use to ...

9. Why does `struct sockaddr` contain a address family field?    stackoverflow.com

Why does struct sockaddr contain an address family field? Isn't the address family already fixed with the call to socket()?

10. second to nanosecond - struct itimerspec    stackoverflow.com

i am populating the timespec structure. The intention is, user will always enter values in seconds (can also be 0.01 secs), so we are converting the seconds to nanoseconds using: lt_leak_start ...

11. why we still have the sun_family in the struct sockaddr_un?    stackoverflow.com

I'm a newbie in UNIX programming. Normally, when we use local socket to communicate, the domain is always AF_UNIX or AF_LOCAL. So in this case, struct sockaddr_un serves always for the ...

12. why does the C readdir man page say to not call free on the static allocated result struct    stackoverflow.com

$ uname -a

Linux crowsnest 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 23:42:43 UTC 2011 x86_64 GNU/Linux
$ man readdir:
DESCRIPTION The readdir() function returns a pointer to ...

13. Detecting and concatenating a multi-line structure using sed    stackoverflow.com

So, given that I have some type of data structure like this within a segment of code:

struct apple {
    int type, color;
    Apple app;
};

// ... ...

14. Compressing a structure definition into a single line and make two copies with sed    stackoverflow.com

There has been an attempt at this question already, Detecting and concatenating a multi-line structure using sed, but none of the answers worked for my specific case. I have a program ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.