Can I do this with class objects ?
class xyz{ ... ... }; while(i<n){ xyz ob; ... ... } Do I need to destroy the earlier object before reallocating memory to it? ...
class xyz{ ... ... }; while(i<n){ xyz ob; ... ... } Do I need to destroy the earlier object before reallocating memory to it? ...
Mr. Lidström and me had an argument :) Mr. Lidström's claim is that a construct shared_ptr<Base> p(new Derived); doesn't require Base to have a virtual destructor. @Daniel: Really? Will the shared_ptr clean up correctly? Could you please in this case demonstrate how that effect could be implemented? – Armen Tsirunyan @Armen: The sh...
Hello all I need to encrypt text what is the best encryption to use programmatically ? In general I have input file with string that I need to encrypt then read the file in the application Decrypt it for the application flow . with c++ ...
hello, i am getting an problem string ccc="example"; int cc=atoi(csession); it says cannot convert ‘std::string’ to ‘const char*’ for argument ‘1’ to ‘int atoi(const char*)’ do i should convert the string to char array and then apply to atoi or is there is any other way ...
hello. i am looking for the best linux library that will let me detect a string charset. any idea ? ...
Is there any way to dump the call stack in a running process in C or C++ every time a certain function is called? What I have in mind is something like this: void foo() { print_stack_trace(); // foo's body return } Where print_stack_trace works similarly to caller in Perl. Or something like this: int main (void) { //...
Hi! I'm writing a cross-platform application, and I need the total available disk space. For posix systems (Linux and Macos) I'm using statvfs. I created this C++ method: long OSSpecificPosix::getFreeDiskSpace(const char* absoluteFilePath) { struct statvfs buf; if (!statvfs(absoluteFilePath, &buf)) { unsigned long blksize, ...
In Visual Studio, you create a .dll project and it creates a .dll and .lib files. You link statically to the .lib, and if the .dll is in the same folder as the .exe, everything works. I suspect that everything would also work if the .dll was in System32 or any other PATH folder (confirm or correct, please). But here's the question: I ...
All works good if I insert sdl-config output manually. How to fix this bug? g++ -O3 -c 'sdl-config --cflags' test.cpp g++.exe: sdl-config --cflags: no such dile or directory ...
This is a further question for my previous one here. Is there a general solution for this? ...
template<typename T> class A { public: A(T b) : a(b) { } private: T a; }; A object(12); //Why does it give an error? Why can't the type T be deduced from the argument 12 automatically? ...
I have to interface with some C code from C++ class constructor (Intel library) class A{ A{ x = ippiMalloc(); if(x==NULL) ... } } In the constructor malloc function (intel version) is used. If ippiMalloc function do not succeed what is the correct way to handle it. Throw exception? ...
i want to find an object with O(logN) and also remove with O(log N) - but no go to balanced tree implementation.. any idea's for that? ...
consider the following code: class A { friend class B; friend class C; }; class B: virtual private A { }; class C: private B { }; int main() { C x; //OK default constructor generated by compiler C y = x; //compiler error: copy-constructor unavailable in C y = x; //compiler error: assignment operator unavailable in...
template<class T> struct IsFunc { typedef char one; typedef struct { char dummy_[2]; } two; static one f(...); static two f(T (*)[1]); enum {value = (sizeof(f<T>(0)) == 1)}; }; And if I try to run it in main: void functionA(); int _tmain(int argc, _TCHAR* argv[]) { int a = 0; ...
I want to create a child process that call another program (with C++ in Unix). But I want to restrict the child process not to call system(), fopen(), etc. (if it did, it would be terminated). How to do that? ...
Hi everyone. I'm building ActiveX component in MFC. The problem is that all properties automatically added to miscellaneous section. I want to unite some new properties with new category. I haven't found it in any microsoft samples. However in some advanced ActiveX controls like Component One controls there are new categories, so it is...
In c++ we can write: #include <iostream> class Base1 { public: void test() { std::cout << "Base 1" << std::endl; } }; class Base2 { public: void test() { std::cout << "Base 2" << std::endl; } }; template<class T> class Derived: public T { }; int main() { Derived<Base1> d1; Derived<Base2> d2; d1.test(); d2.test()...
Hallo I have this assignment to print only alphabets in a C++ string. It works for most input but when [ and ] are present in the input they are printed as well. #include <iostream> #include <string> using namespace std; int main() { string input = "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG]"; for(int i=0;i<input.s...
Hello I have seen two Asterisk C++ API: * Astxx: Asterisk C++ API and Utility library. a C++ wrapper for Asterisk enabling developers * C++ Asterisk Manager API wrapper. Supports receiving events from the Asterisk server and sending actions to Asterisk. Did somebody try one of these projects? Thanks in advance. ...