c++ using list class:: insert()

Thread Tools Search this Thread
Top Forums Programming c++ using list class:: insert()
# 1  
Old 01-12-2008
c++ using list class:: insert()

I am new to STL in c++ and using list class.
I had a application in which I have to insert object of a class into a list at particular position......
So first of all I had to call function through which I will take a position where i had to insert in a list then increment iterator to that position and insert at that location ..
I had used it like this:::::::::
void Data::addPacketFromSerial(char *rawData)
int psn; //where to add in the list//
list <Packet>::iterator Iter;
Packet objPacket(rawData); //creating object of class packet and passing rawData to it's constructor//
objPacket.parseRawData(); //calling parseRawData to parse the packet//
psn=objPacket.getPsn(); //get the psn from packet class
packetArr.insert(Iter,objPacket); //insert at particular position


but its not doing it correctly????????/
please guide me as soon as possible.....
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

C++ : Base class member function not accessible from derived class

Hello All, I am a learner in C++. I was testing my inheritance knowledge with following piece of code. #include <iostream> using namespace std; class base { public : void display() { cout << "In base display()" << endl; } void display(int k) {... (2 Replies)
Discussion started by: anand.shah
2 Replies

2. Programming

Size of Derived class, upon virtual base class inheritance

I have the two class definition as follows. class A { public: int a; }; class B : virtual public A{ }; The size of class A is shown as 4, and size of class B is shown as 16. Why is this effect ?. (2 Replies)
Discussion started by: techmonk
2 Replies

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

4. UNIX for Dummies Questions & Answers

insert string at end of line if it found from list

Hi all, can some one help me out file 1 i have 06/01 3:14 d378299 06/01 8:10 d642036 06/01 10:51 d600441 06/01 10:52 d600441 06/01 11:11 d607339 06/01 11:49 d398706 something like this and in file named list i have ( there is space btwn 06/01 and 11:49 and d398706) d607339... (5 Replies)
Discussion started by: zozoo
5 Replies

5. Programming

static use for class inside the same class c++

Hi, I believe the next code is wrong: class Egg { Egg e; int i; Egg(int ii=0) : i(ii) {} }; because you would end up with an endless definition (memory allocation) of Egg objects, thus int i. Ok, so God Eckel proposes for a singleton: class Egg { static Egg e; int... (5 Replies)
Discussion started by: xavipoes
5 Replies

6. Shell Programming and Scripting

Match and insert in a sorted list

I have a sorted list (python) and I want to insert a string if it matches the pattern in list. Example : Sorted List Above list is in sorted order. I need to insert a name in sorted order and also if the name already exist then it should be inserted before the existing... (1 Reply)
Discussion started by: pratapsingh
1 Replies

7. Shell Programming and Scripting

Parsing fields from class list files to use output with newusers command

Hello I am trying to develop a shell script that takes a text file such as this... E-mail@ Soc.Sec.No. *--------Name-----------* Class *School.Curriculum.Major.* Campus.Phone JCC2380 XXX-XX-XXXX CAREY, JULIE C JR-II BISS CPSC BS INFO TECH 412/779-9445 JAC1936 XXX-XX-XXXX... (7 Replies)
Discussion started by: crimputt
7 Replies

8. Programming

C++ class definition with a member of the same class

Hi, i have a question about C++. Is it possible to declare a class with a member ot the same class? For example, a linked list or i want to convert this C code to C++ class (Elemento) typedef struct elemento { char name; char value; List<struct elemento> ltElementos; ... (7 Replies)
Discussion started by: pogdorica
7 Replies

9. UNIX for Dummies Questions & Answers

car class (not school class)

im just trying to have some fun and kill some time writing a c++ program that has a person type in a car make and model then gives them a year and a price. or something like that. i always have problems getting it goin but once the ball is rolling im usually pretty good. anyone wanna help me out? ... (1 Reply)
Discussion started by: rickym2626
1 Replies

10. Shell Programming and Scripting

How list of files apart from *.class files in certain folder

Hi Friends How to list of all files in a particular directory structure, with out listing a particular file extn. I mean to say in a folder structure I have many files ..I want to list them with out *.class files. Please help Thanks Joy (3 Replies)
Discussion started by: itsjoy2u
3 Replies
Login or Register to Ask a Question
APPRES(1)						      General Commands Manual							 APPRES(1)

appres - list X application resource database SYNOPSIS
appres [class [instance]] [-1] [toolkitoptions] DESCRIPTION
The appres program prints the resources seen by an application (or subhierarchy of an application) with the specified class and instance names. It can be used to determine which resources a particular program will load. For example, % appres XTerm will list the resources that any xterm program will load. If no application class is specified, the class -AppResTest- is used. To match a particular instance name, specify an instance name explicitly after the class name, or use the normal Xt toolkit option. For example, % appres XTerm myxterm or % appres XTerm -name myxterm To list resources that match a subhierarchy of an application, specify hierarchical class and instance names. The number of class and instance components must be equal, and the instance name should not be specified with a toolkit option. For example, % appres Xman.TopLevelShell.Form xman.topBox.form will list the resources of widgets of xman topBox hierarchy. To list just the resources matching a specific level in the hierarchy, use the -1 option. For example, % appres XTerm.VT100 xterm.vt100 -1 will list the resources matching the xterm vt100 widget. SEE ALSO
X(7), xrdb(1), listres(1) AUTHOR
Jim Fulton, MIT X Consortium X Version 11 appres 1.0.3 APPRES(1)