79 Posted Topics
Re: 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] | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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, … | |
Re: 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 … | |
Re: 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 … | |
Re: 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: … | |
Re: 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 = … | |
Re: Do this and see what happened: [CODE] template <typename T> class Queue : public CharQueue <T> [/CODE] | |
Re: 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( … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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. | |
Re: 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, … | |
Re: 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 … | |
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 … | |
Re: 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<<" … | |
Re: 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. | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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, … | |
Re: 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. | |
Re: 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. | |
Re: 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); } |
The End.