473,383 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

problem with array of stucture poiners

3
hi,please have a look at this program.
struct tlv
{
uint32_t tag;
uint32_t len;
char val[256];
};


struct tlv *att;

struct tlvlist
{
uint32_t msglen;
struct tlv *source[2];
struct tlv *mesgkey;
struct tlv *delim;
struct tlv *oper;
};

struct tlvlist *attlist;


please find the solution for my question.

q)how can i create the memoy for the source pointer which points to the struct tlv.there can be more than one pointer there as source[n].
where n is found at the runtime.

can any one please find the solution for this to allocate memory to this and also read the values into the variables pointed by the source.

if not possible for the dynamic one please suggest atleast for the static allocation as struct tlv* source[2].

yours sincerely,
samba
Mar 23 '07 #1
1 1375
sicarie
4,677 Expert Mod 4TB
hi,please have a look at this program.
struct tlv
{
uint32_t tag;
uint32_t len;
char val[256];
};


struct tlv *att;

struct tlvlist
{
uint32_t msglen;
struct tlv *source[2];
struct tlv *mesgkey;
struct tlv *delim;
struct tlv *oper;
};

struct tlvlist *attlist;


please find the solution for my question.

q)how can i create the memoy for the source pointer which points to the struct tlv.there can be more than one pointer there as source[n].
where n is found at the runtime.

can any one please find the solution for this to allocate memory to this and also read the values into the variables pointed by the source.

if not possible for the dynamic one please suggest atleast for the static allocation as struct tlv* source[2].

yours sincerely,
samba
What have you tried on this so far?
Mar 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ayende Rahien | last post by:
Serious problem I'm using Chris Lovett's SgmlReader class SgmlReader sr = new SgmlReader(); XmlDocument xdoc = new XmlDocument(); sr.DocType = "HTML"; sr.InputStream = new...
18
by: Ian Stanley | last post by:
Hi, Continuing my strcat segmentation fault posting- I have a problem which occurs when appending two sting literals using strcat. I have tried to fix it by writing my own function that does the...
1
by: jof | last post by:
struct name { char ch; } *ptr1,*ptr2; If this is my structure and if i need to store the address of the pointers ptr1 and ptr2 in an array say "del"..how do i do it? is it right if: struct...
4
by: Michael B Allen | last post by:
Let's say I have a stucture with a flexible array at the end: struct foo { short s; char bits; }; I would like to embed this in other structures like: #define TAILBITS 500
2
by: Jose Ines Cantu Arrambide | last post by:
Hello, I want to store references not values of MyStruct in an Array (MyStruct)... is it possible? How? Thanks, Jose.
7
by: none | last post by:
I'm trying to implement a simple repeateable property mechansism so I don't have to write accessors for every single instance variable I have. ------------ classMyObject: def __init__ (self):...
1
by: | last post by:
I have made a web application that is giving me an error in loading assemblies. It reports file not found (error message below). I know I have the .dll in the .bin directory for the application.: ...
3
by: Irfan | last post by:
hi, I have a fileName stored as a string as shown: String fn = @"C:\drawing\testdrawings\test; which gives fn = "C:\\drawing\\testdrawings\\test; however i dont want '\' to get converted to...
4
by: daroman | last post by:
Hi Guys, i've problem with my small C++ programm. I've just small template class which represetns a array, everything works fine up to combination with std::string. I did tried it with M$ VC++ and...
1
by: pereges | last post by:
I'm trying to build a kdtree for a 3d object. An object contains vertices(3d vectors) and triangles (triangular mesh structure). The idea behind using a kdtree is to split the bounding box(a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.