c++

Low-Level C++ App Crashes on Windows Vista/7 Unless Run in XP Compatibility Mode

Hi, I have a low-level (like really low-level, it's basically all IOCTL calls and several calls to enumeration APIs) that crashes sporadically on Windows Vista/7 on clients' machines. Unfortunately, I have not been able to procure any crash dumps but one helpful user did mention that running the program in XP Compatibility Mode solved t...

How can I convert a decimal code of a character into a Unicode string in C++?

How can I convert a decimal code of a character into a Unicode string in C++? For example, I give it the integer 241, that is the '' spanish letter, and I want to convert it to a Unicode string. ...

When to use pointers in C++

I just started learning about pointers in C++, and I'm not very sure on when to use pointers, and when to use actual objects. For example, in one of my assignments we have to construct a gPolyline class, where each point is defined by a gVector. Right now my variables for the gPolyline class looks like this: private: vector<gVector3*> ...

Is CLIM possible in C++?

CLIM = Common Lisp Interface Manager, it's like the REPL, ported to the GUI. Is something like this similar possible in C++? If so, pointers? Thanks! ...

X throws out errors when forkpty is called. (C++)

Hello, all. When my program gets to this line,: pid_t nPid = forkpty( &m_nMasterFD, NULL, NULL, NULL ); it outputs this: X Error: BadIDChoice (invalid resource ID chosen for this connection) 14 Extension: 148 (RENDER) Minor opcode: 17 (RenderCreateGlyphSet) Resource id: 0x3600002 <unknown>: Fatal IO error 4 (Interrupted sys...

How to organize large (> 10 KLOC) C++ source code to allow efficient search via editor?

This is not about comprehension. This is about "I want to find where this class is defined." I recently had this "insight" where each class in its own .cpp/.hpp file (Java style) each namespace is its own directory So something like Geometry::Math::Vector3 would be in Geometry/Math/Vector3.hpp and Geometry/Math/Vector3.cpp Have ...

C++ typedef question

if I make a typedef someobject* pntr; I can use this typedef to make a pointer to point to an object of type someobject. but can I also use a pointer made from this typedef to point to an array of someobject? ...

Polymorphism by function parameter

Ok - this may be a very stupid question, but it's been bothering me. Is there a language where class Animal; class Ape : public Animal {...} void doStuff(Animal* animalPtr) { cout << "doing animal stuff" << endl; } void doStuff(Ape* apePtr) { cout << "doing ape stuff" << endl; } Animal *ape = new Ape(); doStuff(ape); would...

Is there a better (more modern) tool than lex/flex for generating a tokenizer for C++?

I recent added source file parsing to an existing tool that generated output files from complex command line arguments. The command line arguments got to be so complex that we started allowing them to be supplied as a file that was parsed as if it was a very large command line, but the syntax was still awkward. So I added the ability...

How to detect the current input language?

I am looking for a working code snippet for Symbian S60 5th edition in which: a) an application can detect the current input language (not the UI language); b) an application can receive notifications when current input language is changed. The function CurrentLanguage() from CPtiEngine always returns NULL, so that does not seem to...

How to check if button is pressed and working on LPT port in C++

I have a button I got out of a random item around the house and I wanna hook it up to my LPT port and check if its pressed or not in C++ and if it is display a message. ...

Do <cctype> functions work with Unicode?

Page 601 of the C++ Special Edition says... In <ctype.h> and <cctype>, the standard library provides a set of useful functions for dealing with ASCII and similar character sets. Would Unicode fall under this "similar character sets" category? ...

non-class rvalues always have cv-unqualified types

§3.10 section 9 says "non-class rvalues always have cv-unqualified types". That made me wonder... int foo() { return 5; } const int bar() { return 5; } void pass_int(int&& i) { std::cout << "rvalue\n"; } void pass_int(const int&& i) { std::cout << "const rvalue\n"; } int main() { pass_int(foo()); // prints "rvalu...

Using code generated by Py++ as a Python extension

I have a need to wrap an existing C++ library for use in Python. After reading through this answer on choosing an appropriate method to wrap C++ for use in Python, I decided to go with Py++. I walked through the tutorial for Py++, using the tutorial files, and I got the expected output in generated.cpp, but I haven't figured out what to...

How to receive power off events in console application?

I am looking for a working code example for Symbian S60 5th edition in which a console application can receive power off events (i.e. detect phone switch off). I know how to do this from UI application [AppUI, HandleSystemEventL(const TWsEvent& aEvent), etc], but Windows Server does not seem to send events if simple console application i...

STL-Like range, What could go wrong if I did this?

I am writing (as a self-teaching exercise) a simple STL-Like range. It is an Immutable-Random-Access "container". My range, keeps only the its start element, the the number of elements and the step size(the difference between two consecutive elements): struct range { ... private: value_type m_first_element, m_element_count, m_step; };...

PThread vs boost::thread?

Having no experience with threading in the past, which threading technique in C++ will be the easiest for a beginner? boost::thread or pthreads? ...

Getting the address of the function that called my function with inline assembly

Hello. I would like to know how to retrieve the address of the function that called my function with inline assembly. My idea is to get the address to where the function that called mine will return and using the instruction before it (that is a call to the function that called mine) retrieving the address of the one that called mine add...

C++ Questions: pointers/memory addresses and subclasses

Why are we allowed to run this code: int* FunctionB(int x) { int temp =30; //more code return &temp; } It seems to me that I am not returning what I said I would. Why is it that a memory address can be returned if I declared the return type to be a pointer. Isn't a pointer something that points to a memory address, not...

CoreAudio AudioUnitSetProperty always fails to set Sample Rate

I need to change the output sample rate from 44.1 to 32.0, but it always throws an error, Out: AudioUnitSetProperty-SF=\217\325\377\377, -10865. I don't know why it will let me set it for input, but then not set it for output. My code is: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { OSStatus MyRenderer(void ...