How do I assign a pointer to a variable?
Suppose we have a variable k which is equal 7: int k=7; int t=&k; But this does not work. What's the mistake? ...
Suppose we have a variable k which is equal 7: int k=7; int t=&k; But this does not work. What's the mistake? ...
I have the following definitions: template<typename T1, typename T2> class Test2 { public: static int hello() { return 0; } }; template<typename T> class Test1 { public: static int hello() { return 0; } }; #define VERIFY_R(call) { if (call == 0) printf("yea");} With these, I try to compile the following: VERIFY_R( Test1<int...
Problem is categorized in two steps: Problem Step 1. Access 97 db containing XML strings that are encoded in UTF-8. The problem boils down to this: the Access 97 db contains XML strings that are encoded in UTF-8. So I created a patch tool for separate conversion for the XML strings from UTF-8 to Unicode. In order to covert UTF8 strin...
Hi, I have a main program written in C# which creates and uses objects written in C++. One of these objects, MODULE, uses a Behavior class (C++), which contains a lot of parameters, initialized by an interface managed by the C# main. One of these parameters is a system::Collection::Generic < AnotherObject>, let's call it LIST. The beh...
Hi. I have two source files, one named main.cpp (where the namespace M is defined) and the file engines.h (where serveral names are defined). main.cpp includes engines.h. engines.h need to use the stuff inside M, and M needs to use the stuff inside engines.h. I get an error doing using namespace M; in engines.h. ...
Dear friends, i'm concerned if i'm making a bad use of references in C++ In the following method GCC complains warning "reference to local variable ‘me’ returned" MatrizEsparsa& MatrizEsparsa::operator+(MatrizEsparsa& outra){ MatrizEsparsa me(outra.linhas(),outra.colunas()); return me; } But, with the following changes the warning...
I have a COM Client and a COM Server, the COM Server holds an Interface exposed by the client, now the client is actually just an EXE, how do I make sure that the Interface exposed by the client is visible to the Server? Because when I call CoCreateInstance now on that interface in the server I get a E_NOINTERFACE and I suspect it's bec...
I have a MS C++ project (let's call it project A) that I am currently compiling as a static library (.lib). It defines a global variable foo. I have two other projects which compile separately (call them B and C, respectively) and each links the shared static library A in. Both B and C are dll's that end up loaded in the same process. I ...
Specifically, could you tell me what this line of code does: int var1 = (var2 + 7) & ~7; Thanks ...
Okay, little oddity I discovered with my C++ compiler. I had a not-overly complex bit of code to refactor, and I accidentally managed to leave in a path that didn't have a return statement. My bad. On the other hand, this compiled, and segfaulted when I ran it and that path was hit, obviously. Here's my question: Is this a compiler bug...
I'd like a function, or function object, that can generate a permutation of its inputs with the permutation specified at compile time. To be clear, I am not looking to generate all of the permutations, only a specific one. For instance, permute<1,4,3,2>( a, b, c, d ) would return (a,d,c,b). Obviously, it is straightforward to do this ...
Possible Duplicate: Pass arguments into C program from command line. mypro parameter When run like above,how to get the parameter in mypro's main() : #include <iostream> int main() { char* str = "default_parameter"; if(parameter_exists())str = parameter; ... } How to implement the pseudo code above? ...
I am currently trying to allocate the same amount of memory for a double pointer. I take in a char** and want to use a bubble sort on that char** . So I create a temp char** and now I'm wondering how to correctly allocate enough memory so that I can return that temp char** to another method. I know the way I'm allocating right now doe...
Hi everyone, Here is my code to calculate covariance matrix over a particular area of color image,But it always gives all zeroes.Please help me where am going wrong. IplImage* img = cvLoadImage("image.png",1); cvShowImage("input",img); cvSetImageROI(img,cvRect(10,10,30,30)); { CvMat* covarMatrix=cvCreateMat(3,3,CV_32FC1)...
Hello, I'm new to C++ and was working on an assignment for a class. We were given a .txt file, have to read information from it, and store it in a linked list, and then print it out to the user. After hours of trying to manipulate the examples we were given, and another couple hours of trying to write the code from scratch, I'm getting ...
I've developed web services in C++ and have implemented the ability to provide a base 64 encoded string to send files with other meta data. While I have successfully decoded the string when the encoded data is a text file, images and other binary files are not decoding correctly. Can you point me to a C++ library or implementation of ba...
Hi, Warning: This is most likely a very silly question. I have an object that resides in its own header file and is created in main, I would like to update the said object using a function that is declared in a separate file. If I'm not clear please let me know and I will try and explain my self better. //main #include"Object.h" int m...
Is the above possible? Can I do this: IUnknown *punk; punk->QueryInterface(IID_MyInterface, (void**)&m_pMyInterface); I thought that this would tell me if the MyInterface is supported m_pMyInterface... ...
I have this code: #include <stdio.h> class A { public: A() { printf("A::A()\n"); } A(const A &a) { printf("A::A(A &a)\n"); } A &operator=(const A &a) { printf("A::operator=\n"); } }; class B : public A { public: B() { printf("B:B()\n"); } B(const A &a) : A(a) { printf("B::B(A &a)\n"); } B &operator=(const B &b)...
I tried to use astyle to format the code base I've to work with. When I use the option --add-brackets the executable is not identical (If I only use -t and/or -b the output is identical). if(a) return b is modified to if(a) { return b } So my question is. Does gcc generate the same output if I only add and/or delete braces (ob...