I've been spoiled using Java in the last few months! I have a C++ project where I would like to decouple a class interface (.h file) from its implementation details. But the class's member fields have to be in its declaration, and it seems like I have this unavoidable dependency linking if I want to tweak the class's member fields.
I kn...
Hi all,
I've searched and searched stackoverflow for the answer, but have not found what I needed.
I have a routine that takes an unsigned char array as a parameter in order to encode it as Base64. I would like to encode an STL float vector (vector) in Base64, and therefore would need to reinterpret the bytes in the float vector as an ...
When using a QFileDialog to save a file and to specify the extension (like *.pdf) and the user types in a name without this extension, also the saved file hasn't this extension.
Example-Code:
QFileDialog fileDialog(this, "Choose file to save");
fileDialog.setNameFilter("PDF-Files (*.pdf)");
fileDialog.exec();
QFile pdfFile(fileDialog.se...
I’m working on a Windows port of a POSIX C++ program.
The problem is that standard POSIX functions like accept() or bind() expect an ‘int’ as the first parameter while its WinSock counterparts use ‘SOCKET’.
When compiled for 32-bit everything is fine, because both are 32bit, but under Win64 SOCKET is 64 bit and int remains 32 bit and i...
I am using VC 2008.
I call into an MFC regular DLL from a console app in C++. I want to show a top-level window (a form I created that is an IDD_FORMVIEW)
Right now I have no window showing. I am not sure what is wrong.
What do I have to do (starting from scratch) to create a main window in an MFC DLL? This is a regular DLL and ...
I have a method that is suppose to return a garbage value if an item in a tree is not found. All I'm getting though is a runtime exception: "garbage is being used without being defined"
ItemType BstClass::rRetrieve(node* trav, KeyType key, bool& inTree)
{
if(trav == NULL)
{
inTree = false;
ItemType garbage;
return...
Whats the difference?
I want to be able to see if an element is in a HashMap and I just found out that if I do h[element], it will return the default element if it is not found, and not null. How would I use the iterator find method to see if the element is there?
Thanks
...
Hi
I looking for example of program, that modify string inside his exe.
I work with C++, Visual Studio under Windows.
I searched in internet for working examples in Windows, but I doesn't find any working code.
I need simple code, that will ask user for string:
string strTest = "";
(if strTest != "")
{
cout << "Modified: " << str...
My application is transforming an AVI video file into another AVI file. I use
the OpenCV library. Unfortunately videos created with OpenCV have no sound as the library does not support audio.
Is there any easy way to copy the audio track from one video file to another? Maybe FFmpeg?
My application is written in Visual C++.
...
I am confused as to how to get the elements in the set. I think I have to use the iterator but how do I step through it?
...
I want to use "_test_and_set lock" assembly language implementation with atomic swap assembly instruction in my C/C++ program.
class LockImpl
{
public:
static void lockResource(DWORD resourceLock )
{
__asm
{
InUseLoop: mov eax, 0;0=In Use
xchg eax, resourceLock
cmp ea...
As I read in Thinking in java,
Interface and inner class provide more
sophisiticated ways to organize and
control the objects in your
system. C++, for example, does not
contain such mechanisms, although the
clever programmer may simulate them.
Is it true that C++ programmer simluate features that java owns,e.g. interface ...
I am currently reading "programming principles and practice using c++" in chapter 4 there is an exercise in which i need to make a program to calculate prime numbers between 1 and 100.
This is the program i came up with.
#include <vector>
#include <iostream>
using namespace std;
//finds prime numbers using Sieve of Eratosthenes algor...
Hi,
I have an existing C++ source code that is built using autotools and i wish to use in Eclipse CDT. I'm a beginner with Eclipse CDT. I've installed the Autotools plugin for eclipse but don't know how to create a project from existing code.
May you please guide me in the right direction so that i can create an eclipse project that us...
class Interface {
public:
static const int i = 1;
static const double d = 1.0;
//! static const string *name = new string("Interface name");
virtual string getName() = 0;
}
Since C++ is a traditional truely compiled programming language,it could be easily convinced that it does allow object initialization(?).But why do C++...
Hello
I am using Visual Studio 2005 Proffesional Edition.
In the following example SomeClass is class that is defined in third party dll library I am using.
SomeClass has virtual methods. I noticed that the operator typeid gives different results when applied to the type itself, and when applied to object of the type. Is this normal be...
When implementing polymorphic behavior in C++ one can either use a pure virtual method or one can use function pointers (or functors). For example an asynchronous callback can be implemented by:
Approach 1
class Callback
{
public:
Callback();
~Callback();
void go();
protected:
virtual void doGo() = 0;
};
//Constructo...
I need to develop a Windows/Linux command line utility. The utility will talk to middleware that has a standard API on both platforms. I have done some cross-platform development before, on FreeBSD/Linux, which was considerably easier - and I had people in the group with experience that I could talk to.
At this point there is no one...
Hi,
I am a great fan of the video editing sites animoto (and stupiflex), i enjoy computer graphics and also have that as my major subject at university.
My question is, I have trying to guess what would one need inorder to build such an application.
Do any such open-source / free tools do exist that can give the kind of quality offer...
I want to extend the C++ string class, returning subclass references (instead of parent string reference), but this code excerpt...
#include <string>
using namespace std;
class mystring : public string
{
public:
mystring& left( int cnt )
{ return (mystring&)mystring( substr(0,cnt) );
}
};
produces this VS8 compiler error:
...