c++

Issues with Partial Class Function Overrides in C++

Is there any issue with partially overriding a set of virtual functions defined by a base class? My compiler provides the following warning: overloaded virtual function "MyBaseClass::setValue" is only partially overridden in class "MyDerivedClass". The classes look like this: class MyBaseClass { public: virtual void setValue(int...

Bit aligned reading and writing from binary files

I would like to read and write n bits from/to binary files. For example, read the next n bits into an integer or the next n bits to a char. I need the data to be bit aligned and not byte aligned. Are there C++ libraries that allow me to do that? When I use ostream/istream, I seem to be restricted to using byte aligned data. This is no...

iPhone Thumb & VFP

How do 'compile for Thumb' and VFP code relate to each other? on the iPhone 2G/3G, i know that the Thumb instructionset doesn't include floatingpoint calculations (on the 3GS, Thumb2 aparently has..). So what happens, if one compiles for thumb, but uses VFP code for floatingpoint calculations? i know that's pretty indepth - but probabl...

How to mix std::string with Win32 functions that take char[] buffers?

There are a number of Win32 functions that take the address of a buffer, such as TCHAR[256], and write some data to that buffer. It may be less than the size of the buffer or it may be the entire buffer. Often you'll call this in a loop, for example to read data off a stream or pipe. In the end I would like to efficiently return a strin...

C++ error C2059

Solved When I try to compile this program i keep getting these errors: (50) : error C2059: syntax error : '<=' (50) : error C2143: syntax error : missing ';' before '{' (51) : error C2059: syntax error : '>' (51) : error C2143: syntax error : missing ';' before '{' (62) : error C2059: syntax error : 'else' (62) : er...

how to set a threadname in MacOSX

In Windows, it is possible to set the threadname via this code. The threadname is then shown in debuggers. Under Linux, see this question. In MacOSX, I have seen several hints which indicates that there are threadnames. I think the class NSThread also has a name-attribute. My goal is that I can set the threadname in my C++ application ...

If-Then-Else Conditionals in Regular Expressions and using capturing group

I have some difficulties in understanding if-then-else conditionals in regular expressions. After reading If-Then-Else Conditionals in Regular Expressions I decided to write a simple test. I use C++, Boost 1.38 Regex and MS VC 8.0. I have written this program: #include <iostream> #include <string> #include <boost/regex.hpp> int ma...

Reading SDL_RWops from a std::istream

I'm quite surprised that Google didn't find a solution. I'm searching for a solution that allows SDL_RWops to be used with std::istream. SDL_RWops is the alternative mechanism for reading/writing data in SDL. Any links to sites that tackle the problem? An obvious solution would be to pre-read enough data to memory and then use SDL_RWF...

How does the compiler know to use a template specialization instead of its own instantiation?

Consider the following files: Foo.H template <typename T> struct Foo { int foo(); }; template <typename T> int Foo<T>::foo() { return 6; } Foo.C #include "Foo.H" template <> int Foo<int>::foo() { return 7; } main.C #include <iostream> #include "Foo.H" using namespace std; int main() { Foo<int> f; cout << f.foo() << ...

Comparing String Iterator to Char Pointer

Hi, I have a const char * const string in a function. I want to use this to compare against elements in a string. I want to iterate through the string and then compare against the char *. #include <iostream> #include <string> #include <cstring> using namespace std; int main() { const char * const pc = "ABC"; string s = "Test AB...

String to Time Conversion

In C++ is there any way to extract a time from a string? CString str; str="17:18:58,9187120"; Is there any utility for converting this string in to a Time variable? ...

C++ Trouble with operator code inheritage: am I require to copy same code for all derived classes?

I'd like to write a group of class D_I (aka I=1,2,... just I mean '_I' to be class proper name, not integer) which handle some (boolean, for example) operations F with same meaning for all classes. But also I want to operate with "sums" of object of such classes, different classes of the group might be "added" together. Mentioned operati...

PyQt vs PySide comparison

I currently develop many applications in a Qt heavy C++/Python environment on Linux, porting to PC/Mac as needed. I use Python embedded in C++ as well as in a stand alone GUI. Qt is used fro xml parsing/event handling/GUI/threading and much more. Right now all my Python work is in PyQt and I wanted to see how everyone views PySide. I'm i...

How to Set Baud Rate 28800 Using DCB Structure

Previously I was using CBR_9600 when communicating with 9600 baud devices. But there does not seem to be a CBR_28800 setting. Is it possible to set the baud rate using the DCB structure of 28800? ...

why is stroull() not working on a byte array with hexadecimal values?

here is some new test code with regards to my long issue. I figure that if i code my stuff as long long then that is half the battle in porting. the other half would be to make it into big endian so it can work on any 64 bit system. so i did the following: #include <iostream> #include "byteswap.h" #include "stdlib.h" using namespac...

Language recommendations for expanding programming skills (For a semi-experienced software developer)

I have little (<1 year professional) experience with Perl Groovy/Java I have limited (<2 year professional) C I have decent experience (>= 6 years professional) with PHP SQL I have hobby experience with C++/DX9 (some simple windows games/demos) Obj-C (a few iphone app's) ASM (http://www.amazon.com/Assembly-Language-Intel-Ba...

Reading SIM contacts on Symbian S60

I am looking for a working code snippet for Symbian S60 5th edition in which you can read SIM contact details. If possible, I would skip using RPhoneBookSession, but if that is the only way, please provide code snippet how to use it. Thank you. ...

what does this declaration mean? exception() throw()

std::exception class is defined as follows exception() throw() { } virtual ~exception() throw(); virtual const char* what() const throw(); what does the throw() syntax mean in a declaration? Can throw() take parameters? What does no parameters mean? ...

C++ Abstract class operator overloading and interface enforcement question

(edited from original post to change "BaseMessage" to "const BaseMessage&") Hello All, I'm very new to C++, so I hope you folks can help me "see the errors of my ways". I have a hierarchy of messages, and I'm trying to use an abstract base class to enforce an interface. In particular, I want to force each derived message to provide a...

Derived class can't see parent class properly

I'm seeing two problems in a setup like this: namespace ns1 { class ParentClass { protected: void callback(); }; } namespace ns1 { namespace ns2 { class ChildClass : public ParentClass { public: void method() { registerCallback(&ParentCla...