c++

QT: creating an "svg image button"

I'm New to QT so please excuse my ignorance. I am attempting to create a an 'svg image button' with QSizePolicy::Preferred for both horizontal and vertical. That part works. When the window is resized, the button grows and shrinks exactly how I want... But the image within the button stays the same size. I would like the image to scale ...

Gtkmm Tutorial?

Where can I find a Gtkmm tutorial? I'm primarily a C# programmer, but I also know C++. ...

Anyone have some TAP or SNPP examples?

Does anyone know of a good resource with some examples of using the Telocator Alphanumeric Protocol (TAP) and/or the Simple Network Paging Protocol (SNPP) in either C++ or C#? Thanks! ...

Visual Studio - New Filter instead of New Folder when using Create Project From Existing Source Wizard

I used the Create Project From Existing Code Wizard for Visual Studio 2008, but apparently projects created this way do not allow you to create virtual solution folders, and instead only allow you to create actual system folders. I would like to have the standard project setup of Header Files, Resource Files, and Sources Files, but I see...

Removing non-integers from a string in C++

There was a passing comment in a book of mine about people inputting commas into integers and messing up your program, but it didn't elaborate. That got me thinking, so I tried writing a little algorithm to take an std::string and remove all non-integer characters. This code compiles but skips over output. Why isn't anything being assign...

Typographic apostrophe + wide string literal broke my wofstream (C++)

I’ve just encountered some strange behaviour when dealing with the ominous typographic apostrophe ( ’ ) – not the typewriter apostrophe ( ' ). Used with wide string literal, the apostrophe breaks wofstream. This code works ofstream file("test.txt"); file << "A’B" ; file.close(); ==> A’B This code works wofstream file("test.txt"); f...

image subdirectory in c++

Basically, I was hoping to sort of keep my files sorted instead of having them all in the same folder as my executable, but referencing files in sub folders relative to my executable has proven difficult. // DEFINES #define IMAGE_BACKGROUND "\\content\\images\\background.bmp" #define FONT_MAIN "\\content\\fonts\\sai.ttf" The above cod...

Traverse from end to front ( C++ LL Q:1 )

Hi, int LinkedList::DoStuff() { Node *Current = next_; while ( Current != NULL ) { Current = Current->next_; length_++; } // At the last iteration we have reached the end/tail/last node return length_; } there are no more nodes beyond the last. How can i traverse to the tail-end to the front-head? ...

Using COM object in C++ with MinGW compiler

Hi, I have an in-process COM server (i.e. DLL) I'd like to use from a C++ application that's to be compiled with the MinGW suite (using CodeLite IDE). I don't quite know where to start, any tips, suggestions or sample code anyone? Cheers, Matt ...

How do you force a makefile to rebuild a target

I have a makefile that builds and then calls another makefile. Since this makefile calls more makefiles that does the work it doesnt really change. Thus it keeps thinking the project is built and upto date. dnetdev11 ~ # make make: `release' is up to date. How do i force the makefile to rebuild the target? clean = $(MAKE) -f ~/xxx/x...

Why won't a derived class work in an array? (C++)

I've created a class, called vir, with a function move: class vir { public: vir(int a,int b,char s){x=a;y=b;sym=s;} void move(){} }; (It's derived from a class with variables int x, int y, and char sym) I have derived a class from this, called subvir: class subvir:public vir { public: subvir(int a,int b,char s){x=a;y=b...

A good (and free) VCL GUI alternative

I've got a project with a rather messy VCL codebase built on Borland C++ Builder 6. I intend to rewrite most parts of it since it's hardly maintainable in it's current state. I'm looking for a good and free alternative to VCL. It is a Windows-only closed source commercial project. So main requirements are: Free for commercial closed-s...

Power On Self Test

Hi, Any good place to learn about POST and how to design and code one? I am a C++ programmer and quite baffeled with the term. Thanks ...

Is it possible to create a vector of pointers?

Just wondering, because of a problem I am running into, is it possible to create a vector of pointers? And if so, how? Specifically concerning using iterators and .begin() with it, ie: How would I turn this vector into a vector of pointers: class c { void virtual func(); }; class sc:public c { void func(){cout<<"using func...

I notice ints and longs have the same size. Why?

Just noticed this on OSX and I found it curious as I expected long to be bigger than int. Is there any good reason for making them the same size? ...

Why is my vector code asserting? What is an assert anyway?

What exactly is an "assert", or more specifically, how do I get rid of an error. When I create a vector of pointers to a class with data member int x, and then do this: for(I=antiviral_data.begin();I<antiviral_data.end();I++) { if((*I)->x>maxx) { antiviral_data.erase(I); } } And run the program, I get no errors until...

C++ Exp vs. Log: Which is faster?

I have a C++ application in which I need to compare two values and decide which is greater. The only complication is that one number is represented in log-space, the other is not. For example: double log_num_1 = log(1.23); double num_2 = 1.24; If I want to compare num_1 and num_2, I have to use either log() or exp(), and I'm wonderin...

Faster abs-max of float array

I need to draw peak meters for audio in realtime. Minimum 44100 samples per second times a minimum 40 streams. Each buffer is between 64 and 1024 samples. I need to grab the abs max from each buffer. (These are then fed through a kind of lowpass filter and drawn at about 20ms intervals.) for(int i = 0; i < numSamples; i++) { absM...

Brand new to C (how to compile?)

I would like to know what I should use to compile in C. I am brand new to programing in general and would greatly appreciate a comprehensive explanation of this process. I am on Windows Vista. I heard about something called "djgpp" that is free and effective for windows. ...

How to log stuff in console in Visual Studio C++

Hi everybody, I'm working on a little C++-Game in Visual Studio 2008. I want to see the content of a vector after a couple of seconds or after I pressed some buttons. Breakpoints are useless in this case, because they stop me at every call of the gameloop (~60 times per second). How do I debug in this case? Thanks! ...