- Strength to Increase Rep
- +4
- Strength to Decrease Rep
- -1
- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
I have the following code example (in windows): [CODE] int fd = _dup(fileno(stdout)); freopen("tmp","w",stdout); printf("1111"); close(stdout); char buf[100]; FILE *fp; fp = fopen("tmp","r");//in this line fd turns to be 0 if(NULL == fp) return -1; fgets(buf,100 , fp) != NULL ); fclose(fp); [/CODE] I need the value of fd for … | |
I have a program which prints (by printf) to the stdout some data and also calls to function *foo* which also prints to the stdout some data [the way (implementation) of how printing is done from foo is unknown and I can`t see the code of foo]. I have to … | |
I want to implemet linked list in c++ ,while adding new node I dynamicly allocate it, if some allocation fails I would like my program to stop the execution. After the "new Node" fails the exception is thrown so do I have to call the destructor explicitly in the exception … | |
[code]template <int p> bool FComapare (Node *lId, Node* rId) { if(lId->getDiff(p) < rId->getDiff(p)) return true; else if(lId->getDiff(p) == rId->getDiff(p)) { if(lId->getLT() < rId->getLT()) return true; else if(lId->getLT() == rId->getLT()) return (lId->getTFG() < rId->getTFG()); } return false; } vector<set<Node*, bool (*)(Node*,Node*) > > m_F; for (int i = 0;i < partNum; … | |
Hello Given a DAG with [TEX]$|V| = n$[/TEX] and has [TEX]$s$[/TEX] sources, we have to present subgraphs such that each subgraph has approximately [TEX]$k_1=\sqrt{s}$[/TEX] sources and approximately [TEX]$k_2=\sqrt{n}$[/TEX] nodes. (Note: **Approximately** means that each subgraph contains[TEX] \lceil \sqrt{n}\rceil[/TEX] or [TEX] \lfloor \sqrt{n} \rfloor[/TEX] nodes and covers [TEX] \lceil \sqrt{s}\rceil[/TEX] or … | |
I wrote winapi application.Which during creation defined : [code=c++] CreateGLWindow(hwnd,"OpenGL",800,600,16,fullscreen); CreateWindow(TEXT("button"), TEXT("Choose Shading Mode"), WS_CHILD | WS_VISIBLE | BS_GROUPBOX,10, 610, 300, 120, hwnd, (HMENU) 0,hInstance, NULL); CreateWindow(TEXT("button"), TEXT("Wireframe"), WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,20, 630, 100, 30, hwnd, (HMENU)IDC_M_WIRE , hInstance, NULL); CreateWindow(TEXT("button"), TEXT("Flat"), WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,20, 660, 100, … | |
I use OPENFILENAME to get dialog for file browsing and, as a result, I get in char szFileName[MAX_PATH] the filename that user is want to read from. I create ifstream and run open( szFileName) on the ifstream object .unfortunately the ifstream object is null There could be the problem with … | |
Hello, I need to render the mesh.It is given by set of its surfaces each surface is presented by its vertexes(x,y,z) The camera and light source has to be placed at the same place. I use this code: [CODE=c++]//Projection glMatrixMode(GL_PROJECTION); glLoadIdentity(); GLdouble diam = m_allModels.getDiam(); GLdouble left = m_allModels.getCenter()[0] - … | |
Hello I have many different processors (they not the same) for example first has a 3 stage pipe: EXE->MEM->EXE and the second has a 3 stage pipe: MEM->EXE->EXE.I want to decide for the operations in which CPU it has to be computed for example *(R1+R2)+R3 has to be computed in … | |
[CODE] class Key{ public: float m_XX; float m_SLP; Key(float XX,float SLP):m_XX(XX),m_SLP(SLP){} Key(const Key& key):m_XX(key.m_XX),m_SLP(key.m_SLP){} }; struct keyComp { bool operator() (const Key& lhs, const Key& rhs) const { if(lhs.m_XX < rhs.m_XX) return true; else return lhs.m_SLP < rhs.m_SLP; } }; class K{ public: int m_IND; int m_DIR; float m_XC; float … | |
Hello We runing rmi client and server from one computer the code files in the same directory [CODE]javac *java rmic FileImpl start rmiregistry java -Djava.security.policy=policy.txt FileServer[/CODE] after that we start a client [CODE]java FileClient kuku.txt 127.0.0.1[/CODE] Does we intiate several JVMs by starting client and server if not how to … | |
Hello I work with g++ on ubuntu 9.04 Here is a code from cpp file: [code]for(subPipelineStrings::iterator pipelineIterator = pipelineRange.first; pipelineIterator != pipelineRange.second;++pipelineIterator) { pair<set<pipeline>::iterator,bool> uniqRes = uniqPipeline.insert(pipelineIterator->second); if(!uniqRes.second) { pipelineIterator = m_subPipelineStrings->erase(pipelineIterator); } } [/code] Here is a declaration .from h file [code]typedef multimap<size_t,pipeline> subPipelineStrings; [/code] I have following error … | |
[CODE]#include<iostream> using namespace std; struct Base{ virtual void print(){cout << "Base"<< endl;} }; struct Derrived : Base{ void print(){cout << "Derrived"<< endl;} }; template< Base* arr,int size = 10> class Template{ public: void print(){arr->print();} };[/CODE] [CODE]#include "template.h" int main(){ Base *b = new Base(); Derrived *d = new Derrived(); Template<b> … | |
Hello Can define template<int n> class myClass{...........} can I define template <Base *b> class myTemp{ ............. } while class Base is defined properly. Thank you. | |
L = {<M>|L(M) contains all even legth words} How can I show that L is not in RE? | |
Hello i have two questions 1. I have vector that I have delete several members from it after I do it I have a problem to access other member because index if other members has changed. What is the best way to know and access the members of the vector … | |
Hello I need a database 1)I need easily to find a minimal value in the database 2)I want to easily add and remove values(well its trivial I know) I tried to use STL map but I couldn't find an easy way to implement the first requirement. Thank you in advance | |
Hello In many OOP languages "this"(or something similar) is used to point to current object. But i think its an object by itself. Here is what i found" polymorphic object which can point in different times to different object`s types" I like to get some more information about this maybe … | |
[CODE=c++]typedef vector<string> pipeline; typedef vector<pipeline> subPipelineStrings; subPipelineStrings* m_subPipelineStrings m_subPipelineStrings = new subPipelineStrings(3); string *s1 = new string("s1"); string *s2 = new string("s2"); string *s3 = new string("s3"); for (int i = 0; i < m_subPipelineStrings ->size();++i) { pipeline &p = m_subPipelineStrings->at(i); p.push_back(*s1) ; p.push_back(*s2) ; p.push_back(*s3) ; }[/CODE] The question … |