Sponsored Content
Top Forums Programming Declare member of struct as a pointer in c Post 302714141 by jim mcnamara on Thursday 11th of October 2012 09:19:37 PM
Old 10-11-2012
When you send a pointer you are NOT sending data. You are sending an address.
Code:
typedef 
 struct fulMsg { 
int msgType; 
int msgCount; 
uint8_t  *CC;
} fulMsg_t;

You are passing a reference, not the string of characters or binary data array you are pointing to. The reference on the other node is pointing to nothing. That is why you segfault. Unless your method is smart enough to create storage on the remote side and copy the array over there.
This User Gave Thanks to jim mcnamara For This Post:
 

10 More Discussions You Might Find Interesting

1. Programming

Problem accessing struct member

I have a struct as follows... struct A { int a; ucontext_t X; //ucontext_t is another structure } How do I define a pointer to the above structure variable X of the type ucontext_t from within another function? eg. void foo() { struct A a; /////WHAT COMES IN... (1 Reply)
Discussion started by: jacques83
1 Replies

2. Programming

Accesing structure member:Error:dereferencing pointer to incomplete type

$ gcc -Wall -Werror struct.c struct.c: In function `main': struct.c:18: error: dereferencing pointer to incomplete type $ cat struct.c #include <stdio.h> #include <stdlib.h> #include <string.h> /*Declaration of structure*/ struct human { char *first; char gender; int age; } man,... (3 Replies)
Discussion started by: amit4g
3 Replies

3. Programming

Pointer to a struct (with pointers) *** glibc detected *** double free

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)
Discussion started by: jatoo
1 Replies

4. Programming

pass a pointer-to-pointer, or return a pointer?

If one wants to get a start address of a array or a string or a block of memory via a function, there are at least two methods to achieve it: (1) one is to pass a pointer-to-pointer parameter, like: int my_malloc(int size, char **pmem) { *pmem=(char *)malloc(size); if(*pmem==NULL)... (11 Replies)
Discussion started by: aaronwong
11 Replies

5. Programming

linked list node with pointer to struct

Suppose to have: struct Tstudent { string name, surname; int matriculation_num; }; struct Tnode { Tstudent* student; Tnodo* next; } L;I want to deference that "student" pointer. For example, I tried with: *(L->student).matriculation_numbut it not worked, as terminal... (4 Replies)
Discussion started by: Luke Bonham
4 Replies

6. Programming

C++ program is crashing on re-assigning const static member variable using an int pointer

Hi, Can any one tell me why my following program is crashing? #include <iostream> using namespace std; class CA { public: const static int i; }; const int CA::i = 10; int main() { int* pi = const_cast<int*>(&CA::i); *pi = 9; cout << CA::i << endl; } (6 Replies)
Discussion started by: royalibrahim
6 Replies

7. Programming

Dereferencing pointer to a shared memory struct

I have what should be a relatively simple program (fadec.c) that maps a struct from an included header file (fadec.h) to a shared memory region, but I’m struggling accessing members in the struct from the pointer returned by shmat. Ultimately, I want to access members in the shared memory structure... (2 Replies)
Discussion started by: arette
2 Replies

8. 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

9. Programming

Check The value a pointer returned by struct s_client != 0

Hi guys , i got segment fault , and when i trace , found it happens since the value of pointer which is returned by Struct S_client (*ptr) is zero if (ptr !=0)i know , adding above line of code is not the solution and not correct for the case since above line only check for the pointer... (1 Reply)
Discussion started by: pooyair
1 Replies

10. UNIX for Advanced & Expert Users

Get pointer for existing device class (struct class) in Linux kernel module

Hi all! I am trying to register a device in an existing device class, but I am having trouble getting the pointer to an existing class. I can create a class in a module, get the pointer to it and then use it to register the device with: *cl = class_create(THIS_MODULE, className);... (0 Replies)
Discussion started by: hdaniel@ualg.pt
0 Replies
IBV_CREATE_AH(3)					  Libibverbs Programmer's Manual					  IBV_CREATE_AH(3)

NAME
ibv_create_ah, ibv_destroy_ah - create or destroy an address handle (AH) SYNOPSIS
#include <infiniband/verbs.h> struct ibv_ah *ibv_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr); int ibv_destroy_ah(struct ibv_ah *ah); DESCRIPTION
ibv_create_ah() creates an address handle (AH) associated with the protection domain pd. The argument attr is an ibv_ah_attr struct, as defined in <infiniband/verbs.h>. struct ibv_ah_attr { struct ibv_global_route grh; /* Global Routing Header (GRH) attributes */ uint16_t dlid; /* Destination LID */ uint8_t sl; /* Service Level */ uint8_t src_path_bits; /* Source path bits */ uint8_t static_rate; /* Maximum static rate */ uint8_t is_global; /* GRH attributes are valid */ uint8_t port_num; /* Physical port number */ }; struct ibv_global_route { union ibv_gid dgid; /* Destination GID or MGID */ uint32_t flow_label; /* Flow label */ uint8_t sgid_index; /* Source GID index */ uint8_t hop_limit; /* Hop limit */ uint8_t traffic_class; /* Traffic class */ }; ibv_destroy_ah() destroys the AH ah. RETURN VALUE
ibv_create_ah() returns a pointer to the created AH, or NULL if the request fails. ibv_destroy_ah() returns 0 on success, or the value of errno on failure (which indicates the failure reason). SEE ALSO
ibv_alloc_pd(3), ibv_init_ah_from_wc(3), ibv_create_ah_from_wc(3) AUTHORS
Dotan Barak <dotanba@gmail.com> libibverbs 2006-10-31 IBV_CREATE_AH(3)
All times are GMT -4. The time now is 01:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy