c++

Mac OS X: Where should I store save games for a game delivered as a bundle?

Hi, I'm porting a windows game to Mac OS X. I was wondering where I should store game data such as saved games, user profiles, etc and how I can retrieve that path programmatically in C++? The game will be delivered as a "modern bundle" as specified here ...

Is there an STL and UTF-8 friendly C++ Wrapper for ICU, or other powerful Unicode library

I need a good Unicode library for C++. I need: Transformations in a Unicode sensitive way. For example sort all strings in a case insensitive way and get their first characters for index. Convert various Unicode strings to upper and to lower case. Split text at a reasonable position -- words that would work for Chinese and Japanese as ...

Free IntelliSense for C++ in Visual Studio

Does anybody here know any free IntelliSense tool available for C++ which is atleast 50% of the features of Visual Assist X (Which of course is not free)? Basically I want my intellisense to work without loading my full workspace/solution? I had seen Visual Assist and it provides this feature. ...

How to use my logging class like a std C++ stream?

I've a working logger class, which outputs some text into a richtextbox (Win32, C++). Problem is, i always end up using it like this: stringstream ss; ss << someInt << someString; debugLogger.log(ss.str()); instead, it would be much more convenient to use it like a stream as in: debugLogger << someInt << someString; Is there a ...

How can I capture a stack trace on the QA computers

I am writing a Qt/C++ application, up until this month I have been using Mingw for compiling and drmingw for getting the stack trace from the QA people. However I recently converted over to MSVC++ 9 so that I can use the phonon framework. The downside is that now the stack traces from drmingw are useless. What do others use? ...

C++ Newbie: Having all sorts of problems linking

I am having several problems with tessdll in Visual Studio 2008. FYI, I created this app as an MFC application, I did this just to take advantage of the simple GUI I needed. It is just straight C++ and win32 from there on out. This builds fine as a debug release for some reason (as I have included the header files and lib files that I n...

Any improvements on the GCC/Windows DLLs/C++ STL front?

Yesterday, I got bit by a rather annoying crash when using DLLs compiled with GCC under Cygwin. Basically, as soon as you run with a debugger, you may end up landing in a debugging trap caused by RtlFreeHeap() receiving an address to something it did not allocate. This is a known bug with GCC 3.4 on Cygwin. The situation arises because ...

Wanted: a C++ template idea to catch an issue, but at compile time?

Hello, We have a const array of structs, something like this: static const SettingsSuT _table[] = { {5,1}, {1,2}, {1,1}, etc }; the structure has the following: size_bytes: num_items: Other "meta data" members So the "total size" is size_bytes*num_items for a single element. All of this information is in the const array, availabl...

C/C++ read a byte from an hexinput from stdin

Hi.. Can't exactly find a way on how to do the following in C/C++. Input : hexdecimal values, for example: ffffffffff... I've tried the following code in order to read the input : uint16_t twoBytes; scanf("%x",&twoBytes); Thats works fine and all, but how do I split the 2bytes in 1bytes uint8_t values (or maybe even read the first ...

Is there something that I can do in C but I can't do in C++ ?

Is there something that I can do in C but I can't do in C++ ? I stumbled upon the question in a sample interview questions site... ...

How to create type-safe int - enum in C++?

I need to create many classes that are somewhere between integer and enum. I.e. have the arithmetics of integer but also are not implicitly converted to int. ...

Is there a way to use C++/CLI managed Enums as array subscripts?

i have an enum declared as enum class AccessLevel : int { ReadOnly = 0, Excluded = 1, ReadWrite = 2, }; and an Array declared as static array<String^>^ _accessMap = gcnew array<String^> { "R", "X", "W" }; I want to do something like this: AccessLevel^ access = access::ReadOnly; String^ foo = _accessMap[access]; ...

Simple way to validate command line arguments

How to check if argv (argument vector) contains a char, i.e.: A-Z Would like to make sure that argv only contains unsigned intergers For example: if argv[1] contained "7abc7\0" - ERROR if argv[1] contains "1234\0" - OK ...

Openssl: Querying extensions on X509 certificates

I am working with the openSSL library's X509 certificate class, and I need to query the "key usage" extension. After abandoning openSSL's vapourware "documentation", some shot-in-the-dark web searching eventually revealed that I needed to call X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx) and searching through the objects...

Using enum inside types - Compiler warning C4482 C++

I am using fully qualified name of the enum inside a method in one of my class. But I am getting compiler warning which says "warning C4482: nonstandard extension used: enum 'Foo' used in qualified name". In C++, do we need to use enums without the qualified name? But IMO, that looks ugly. Any thoughts? ...

Example of using FindFirstFIleEx() with specific search criteria.

I asked about finding in subdirs with criteria. First answer was use FindFirstFileEx(). It seems the function is no good for this purpose or I'm using it wrong. So can someone explain how I would go about searching in a folder, and all it's subfolders for files that match (to give some sample criteria) .doc;.txt;*.wri; and are newer ...

MS SQL stored procedure returned result sets with ODBC

I have a stored procedure and if the stored procedure does this: SELECT 0 As Ret DELETE FROM table where value1 = 1 Returns 1 row result with its value of 0 and column name Ret But if I do this: DELETE FROM table where value1 = 1 SELECT 0 As Ret I get no returned results. My question is, how do I get the second variation to retu...

How to validate numeric input C++

I'd like to know how to limit an input value to signed decimals using cin. (C++) ...

Templatized branchless int max/min function

I'm trying to write a branchless function to return the MAX or MIN of two integers without resorting to if (or ?:). Using the usual technique I can do this easily enough for a given word size: inline int32 imax( int32 a, int32 b ) { // signed for arithmetic shift int32 mask = a - b; // mask < 0 means MSB is 1. return a +...

Is it more efficient to branch or multiply?

I am trying to optimize a small, highly used function which uses the high bits in an unsigned short int to indicate the values of an array to sum together. At first I was using the obvious approach shown below. Please note that loop unrolling is not explicitly shown as it should be done by the compiler. int total = 0; for(unsigned short...