Is there any way I can access Private member variable of a class?
Is there any way I can access Private member variable of a class? Editing: Not from a member function or friend function but through an instance. ...
Is there any way I can access Private member variable of a class? Editing: Not from a member function or friend function but through an instance. ...
How do I create a resource dll ? The dll will be having a set of .png files. In a way these .png files should be exposed from the dll. My application would need to refer this dll to get a .png file. ...
For example: template <typename T, typename U> class TC { public: void Foo(); }; template <typename T, typename U> void TC<T, U>::Foo() { } template <???, typename U> void TC<int, U>::Foo() { //Want this defined for all U but only when T is int. } int main(int argv, char * args []) { TC<int, char> tc; return 0; } Thanks very ...
I was wondering how you open a file in the app bundle from a C++ file. I.E. I have a file "manifest.xml" that is begin copied into the app bundle. I need a way from C++ to either load this file. I think it is going to involve setting a path some where in Obj-C code so that the file is in the working directory. ...
Hello all i like to build desktop application , that will be must user friendly in view what i mean is that the look and feel will be natural in the way the user used to see windows apps . and this toolkit/framework to be as much as possible easy fast to develop from the developer side in c++ . ...
A function call returning a structure is an rvalue expression, but what about its members? This piece of code works well with my g++ compiler, but gcc gives a error saying "lvalue required as left operand of assignment": struct A { int v; }; struct A fun() { struct A tmp; return tmp; } int main() { fun().v = 1; } gcc...
Which is more efficient if(!var_name) or if(var_name == NULL) ...
Hi, I have question about inline assembler. It's possible to call another assembler subroutine from inline assembler within the same function? For example: void FindValidPID(unsigned int &Pid) { __asm { sub esp, 20h mov eax, Pid add eax,eax call sub123 ; another assm subroutine mov Pid, ...
I get this problem in a c++ problem compiling in Ubuntu g++ version 4.4.3. I dont know the headers to include to solve this problem.. Thanks centro_medico.cpp: In constructor ‘Centro_medico::Centro_medico(char*, char*, int, int, float)’: centro_medico.cpp:5: error: ‘strcpy’ was not declared in this scope centro_medico.cpp:13: warning: d...
Hi, as its legal to convert a pointer to non-const to a pointer to a const.. similarly,why isnt it legal to convert (pointer to pointer to non-const) to a (pointer to pointer to a const) i.e, char *s1 = 0; const char *s2 = s1; // OK... char *a[MAX]; // aka char ** const char **ps = a; // error! Thanks. ...
Hi, Usually static members/objects of one class are the same for each instance of the class having the static member/object. Anyways what about if the static object is part of a template class and also depends on the template argument? For example, like this: template<class T> class A{ public: static myObject<T> obj; } If I would c...
I have a data file which contains data in row/colum form. I would like a way to read this data in to a 2D array in C or C++ (whichever is easier) but I don't know how many rows or columns the file might have before I start reading it in. At the top of the file is a commented line giving a series of numbers relating to what each column h...
I have process Id , I want to get its process handle. Is there any API available for that. I tried to use OpenProcess but it returns NULL, and GetLastError =0. This I am trying on Vista. I guess I need to enable SeDebugPrivilege before using OpenProcess . But for enabling SeDebugPrivilege I need to get its Process handle. ...
In attempting to upgrade some C++ software to run in Windows 7 I have experienced some problems in being able to create registry keys from scratch. This is my code: // // Create a brand new registry key // LONG Registry::CreateRegister( std::string path ) { HKEY hKey; DWORD dwDisposition; LONG openRes = RegCreateKeyEx( H...
I draw textures using the D3DXSprite. I want to transform them(rotate, scale etc..) so I use the SetTransfrom method. Should I, store the old transformation -> set a new one -> draw -> set the old one? I have a sprite class whice take care of the Draw and the Update methods. I mean something like this: D3DXMatrix oldMatrix; sprite->GetT...
Hi, tl;dr - Could you please expand on the 4 comments in the first code snippet below? Specifically what is meant be deref I'm a long time Java developer looking to learn C++. I came across this website aimed at developers in my situation. int x, *p, *q; p = new int; cin >> x; if (x > 0) q = &x; *q = 3; ...
Hi Im on mac snow leopard and test these code on xcode3.2 of the Learning OpenCV everything works fine but the image doesnt appear and in the windows. I had try to understand searching for two days what does argv[1] means, but Im still no clear. Im a newbie en C++. I had the image in the same directory where the main.cpp is #include <Op...
hi, i'm having a weird problem with allocating memory in c++ i'm creating a buffer and read file content into it. problem is the allocating is incorrect and at the end of the printing there are weird chars... the content of the file is "Hello"... i'm sitting on it for hours... what can be the problem ? :( void main() { FILE *fp; char...
HI, I started learning C++ STL's i am just trying some small programs.one of them is below: inline int const& max (int const& a, int const& b) { return a < b ? b : a; } template <typename T> inline T const& max (T const& a, T const& b) { return a < b ? b : a; } int main() { ::max(7, 42); // calls the nontemplate...
I'm currently stuck finding the correct syntax for trimming each string in a std::vector. I tried std::vector<std::string> v; std::for_each(v.begin(), v.end(), &boost::trim); which gave me the following error messages in MSVC7.1. error C2784: '_Fn1 std::for_each(_InIt,_InIt,_Fn1)' : could not deduce template argument for 'T1' from ...