79 Posted Topics

Member Avatar for chamika.deshan

in your header file, do following: [CODE] //at the very beginning add the following lines #ifndef TEST_H_ #define TEST_H_ // your class and everything you want in this header file #endif /* TEST_H_ */ //and this will be your last line [/CODE]

Member Avatar for chamika.deshan
0
2K
Member Avatar for lotrsimp12345

Hi, This is little bit big project. You have to give effort, and i can only give guidelines. First of all, I would suggest to use the thread to do this project, not the process. you need to learn following things: 1) C++ basics, (inheritance) 2) threads (start, stop and …

Member Avatar for lotrsimp12345
0
510
Member Avatar for geethasree

1st question: Linux / windows? if you are working in Windows, I am sure there will be similar method call like pthreads. Following examples are given using pthread. Answer of Q 1) You can create a thread from the constructor but why do you want to create a thread from …

Member Avatar for geethasree
0
2K
Member Avatar for simply_viks

use the accept() function to accept the new socket, and for every socket start a thread, which will listen and send. You can use poll() or select() to listen on multiple sockets, so you can even use one thread for all the sockets. read about accept, poll and select, also …

Member Avatar for Ancient Dragon
0
151
Member Avatar for frogboy77

If you like maths/graph problems/AI/dynamic programming or even simple string manipulation... look here [url]http://online-judge.uva.es/p/[/url] Thousands problems of different levels, solve the easy one first, then move on to the more higher one. They have yearly programming contests, top programmer of this contest are highered by all the big names: Google, …

Member Avatar for gerard4143
0
222
Member Avatar for tikoti

Hi, I think its not because of the different compiler, its because may be synchronization of parent and child is not happening properly, wait is getting executed even before child process starting.. or something like that? anyway, try this code and see what happened: [CODE] pid = fork(); switch(pid){ case …

Member Avatar for tikoti
0
3K
Member Avatar for daviddoria

Wait a minute, if i understand properly, do you really want to do this: [CODE] itk::RescaleIntensityImageFilter<itk::Image<unsigned char, 2>::Pointer , itk::Image<unsigned char, 2>::Pointer >::Pointer RescaleFilterType = itk::RescaleIntensityImageFilter<itk::Image<unsigned char, 2>::Pointer , itk::Image<unsigned char, 2>::Pointer >::New(); [/CODE] Because so far i understood, you are creating pointer to pointer type class and most probably …

Member Avatar for Fbody
0
4K
Member Avatar for dorien

You dont have to delete or erase, run it in a while loop, every time you find a occurence, start searching after the found position of the sequence here is a sample, modify it for your need: [CODE] int main () { vector<int> myvector; vector<int>::iterator it; // set some values: …

Member Avatar for dorien
0
2K
Member Avatar for Lazarrus

Hi, So far i remember using perOrder you wont be able to sort, you need inorder traversal, but I have done long , literally long time ago. But anyway, here is the sudo code of preorder using stack. [CODE] BSTPreOrder(Node *root){ Push root into stack. while(stack not empty){ node = …

Member Avatar for alwaysLearning0
0
74
Member Avatar for ace8957

Do this and see what happened: [CODE] template <typename T> class Queue : public CharQueue <T> [/CODE]

Member Avatar for Fbody
0
738
Member Avatar for modesto916

Practice as much as possible. And think simple. You just have to give output "*" and " " in front of "*" for row 2, 5 and 7 [CODE] for(i = 1; i <= 8; i++){ //For row 2 or 5 or 7, we will give output a space if( …

Member Avatar for alwaysLearning0
0
256
Member Avatar for timb89

Why you are doing it as BFS, so far i understand you just have to give output for the adjacent nodes, and that are already mention in the input, 0 1 1 0 1 0 0 0 1 0 0 1 0 0 1 0 there is already a path …

Member Avatar for alwaysLearning0
0
172
Member Avatar for tokenjoker187

Hi, First thing is error: [CODE] StateSpace *state = fringe.front(); // Returns top of fringe fringe.pop(); // and now you are deleting it!!! pop also calls the destructor. so if you are accessing state after this, thats invalid memory access.. [/CODE] [CODE] if( a >= 0 && a < 3 …

Member Avatar for alwaysLearning0
0
4K
Member Avatar for ixmike88

Linux or windows? If it is windows then i cant help :) In Linux any plugin usually developed as a SO file (shared library) which can be loaded runtime by a server which knows which interface to load, (usually a structure with function pointers) A tutorial on [URL="http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html"]Static, Shared Dynamic …

Member Avatar for ixmike88
0
127
Member Avatar for ComradePatriot

first thing i notice is tree data structure is not correct and recursion here wont work as there is some fundamental mistakes. data structure should be something like following [CODE] struct node { char title[TITLE]; struct node *parent; struct node * firstchild; //This is the head of the LL that …

Member Avatar for alwaysLearning0
0
589
Member Avatar for ayoitzrimz

I develop code on Mac and Linux for unix platform, and mainly server side code, so i have very little(actually none) experience with GUI development, anyway, I use Eclipse on centos and mac. Never tried any IDE or any development on windows ;) I also like netbean. IMHO use netbean …

Member Avatar for ayoitzrimz
0
169
Member Avatar for ImaginaryHero

pjsip is a very good sip stack. [URL="http://www.pjsip.org/"]http://www.pjsip.org/[/URL] have you every developed any client server software? You need to know about client/server, tcp/udp, sip, rtp(codec) take it slowly, and start with simple sip client.

Member Avatar for alwaysLearning0
0
3K
Member Avatar for akssps011

Have a look at [url]http://www.tcpdump.org/[/url] source code, it uses libpcap library. Best way to learn anything to work with opensource. You can use libpcap library, or if you want to develop everything, then have a look at that library how they have implemented. dont just copy and paste the code, …

Member Avatar for alwaysLearning0
0
111
Member Avatar for bejfake

I just want share my 2 cents, you can implement typelist and variant, here is a library which has demonstrate and explained implementation of these design patterns, this is really powerfull. [URL="http://www.codeproject.com/KB/cpp/TTLTyplist.aspx"]http://www.codeproject.com/KB/cpp/TTLTyplist.aspx[/URL] Using this you can do following stuff: [CODE] struct my_type { int x; my_type() : x(0) {} virtual …

Member Avatar for alwaysLearning0
0
3K
Member Avatar for alwaysLearning0

This is just for fun and to see how people do it, it will help me to learn different techniques also. If no one answers i will understand. :) Lets say you have a template class. You want a certain method of this class will have some sort of checking …

Member Avatar for mike_2000_17
0
186
Member Avatar for realproskater

What are you trying to do? can you please try to explain the logic behind this while loop? I think you want to print out a calendar, but the logic below wont work at all. [CODE] while (count<=days){ switch(day){ case 1: cout<<count<<"\t";break; case 2: cout<<"\t"<<count<<" "; break; case 3: cout<<"\t\t"<<count<<" …

Member Avatar for realproskater
0
594
Member Avatar for sid78669

Passing by reference/pointer should work, are you sure your are passing by reference, not creating a local copy? if you post some code, then it will be much more helpful to figure out why recursion is not working with reference.

Member Avatar for arkoenig
0
155
Member Avatar for ehsantl

Hi, you are adding local vairble to the list, so when you are accessing it, that memory is already freed as it was local vairble. [CODE] void City::setNextCity(City city) { //city is local vaible here!! nextCities->AddElement(&city); // This is working fine! IT WILL WORK AS CITY IS STILL VALID REFERENCE …

Member Avatar for alwaysLearning0
0
139
Member Avatar for mike_2000_17

Hi, I was waiting for someone to post a better and more specific solution to you. I dont consider myself as c++ guru. So definitely there will be better solution, but here is one of the technique i learned from Modern C++ deisgn of Andrei Alexderscu. you can catch compile …

Member Avatar for mike_2000_17
0
251
Member Avatar for rpdm

OK, So far looks good, but do you want more generic? IF NO, then dont have to read any more. But YES ? Then you can add policy design pattern with it using template. there are several kind of BST (RED-BLACK, AA, AVL, SPLAY.. it goes on and on) All …

Member Avatar for alwaysLearning0
-1
112
Member Avatar for sahil1991

Hi, Please search at search at google at there are lots of information regarding this. But for very simple info, every process created by the operating system has 3 memory blocks to store variables,fucntions. These are: Heap: Dynamically allocated memory are created here. if you allocate any memory using alloc/calloc/malloc, …

Member Avatar for mike_2000_17
0
158
Member Avatar for Spinz

Use matrix, for any graph matrix is the best structure to use, you can easily find the edges in O(1). For BFS, you need to implement a queue to do the BFS on the graph matrix.

Member Avatar for alwaysLearning0
0
73
Member Avatar for aladar04

You have bytesPerRecord=38 but accounts.txt has different size of records which ultimately messing up your seekg calculation. Make sure all the records in account.txt is of size 38 bytes.

Member Avatar for alwaysLearning0
0
109
Member Avatar for awk

char s1[100] = "Lets see what it does?", s2[100]=" ", *tok; tok = strtok(s1, s2); while(tok != NULL) { printf("%s\n", tok); /*Put tok in your struct here*/ tok = strtok(NULL, s2); }

Member Avatar for awk
0
130

The End.