c++

invalid use of typedef?

To save some space in my code, I made this typedef: typedef clients.members.at(selectedTab) currentMember; however, g++ gives me this error: error: expected initializer before '.' token I figure that I'm misusing typedef, since clients.members.at(selectedTab) is a function call and not a type. Is there a way to do what I'm trying ...

Tiny asymmetric cipher implementation to validate download

To allow a small C++ application to update itself at clients connected over the internet, I am in need of a mechanism that validates the download based on a public key. Algorithms such as DSA or RSA seem to be able to do this nicely. However, looking at well-known available libraries for this (Crypto++, LibTomCrypt) they all end up maki...

Autogenerated files and VC++ 2008 projects

Hello, all. I was wondering if there's a way to add Autogenerated files to a VC++ 2008 build. It seems like it's a fairly trivial thing to do if you write your own makefile, but I'd prefer to let visual studio construct a makefile from the project (like it does normally), but also tell it to say "include all .cpp's and .h's that are in ...

How to find all matching numbers, that sums to 'N' in a given array

My goal here is to find all possible combinations that sums to a given total. For example, if the array is 2 59 3 43 5 9 8 62 10 4 and if the total is 12, then possible combinations are 2 10 3 9 8 4 5 3 4 Here is the first set of code, that I've written. Wondering the best improvements that can be done on this. int find_numbers...

Change case of QT Moc file

I recently refactored old code files from ABCFile.cpp/.h to AbcFile.cpp/.h to match my company's coding standards. After updating all the references to the old case styling, the code is compiling and running just fine, but looking at qt's automatically generated moc files the casing matches the old style. What do I need to update qt's ...

Building a C DLL compatible with Dreamweaver.

The documentation I am referencing is here, and is fairly short and to the point: http://livedocs.adobe.com/en_US/Dreamweaver/9.0_API/help.html?content=dwr_sourcecontrol_so_01.html The problem I am running into is that I am not sure how to compile the actual DLL. The last reply on the adobe extension forums is 3 months old, and I am not...

Detecting a sequence of files

I need to import file sequences into a Qt program. Import itself is not hard, but I'm pondering what might be the most easiest way to detect if the files form a sequence, e.g.: filename_00001.png filename_00002.png filename_00003.png etc. Now, I have a drag'n'drop import working, and I'm sorting the list of imported files alphabetical...

Is there an environmental variable or equivalent for WinZip?

Is there an environmental variable or equivalent for WinZip32.exe I can use to find it's location path? EDIT - This is an in house tool for a controlled system. Thanks. ...

Why isn't if ("Maya" == "Maya") true in c++?

Any idea why I get "Maya is not Maya" as a result for this code? if ("Maya" == "Maya") printf("Maya is Maya \n"); else printf("Maya is not Maya \n"); ...

In C++ syntax, can the condition of the if else, return a int and still execute the statements within

Here is the code which compiles : int select_object = 0; if( select_object ) //condition returns an int { printf("Hello"); } if condition returns an int and not a boolean will the hello be printed ? When I tested this it printed hello. Any idea why even for an int it executes the print statement. THanks ...

Problem with SetSuspendState

I write a small application to enter the computer to Standby Mode: #include "stdafx.h" #include <windows.h> #include <PowrProf.h> int _tmain(int argc, _TCHAR* argv[]) { SetSuspendState(FALSE, FALSE, FALSE); return 0; } I get this error: 1>Standby.obj : error LNK2001: unresolved external symbol _SetSuspendState@12 1>C:\Document...

Why can't I declare a friend in one class that is a private member of another class?

Given the following code: class Screen; class WindowMgr { WindowMgr& relocateScreen( int r, int c, Screen& s); }; class Screen { friend WindowMgr& WindowMgr::relocateScreen( int r, int c, Screen& s); // ^ cannot access private member declared in class 'WindowMgr' int m_nR, m_nC; }; WindowMgr& WindowMgr::reloc...

How does one swap values?

Possible Duplicate: What is the fastest way to swap values in C? How can I swap the values of two variables without using 3rd variable? I want to swap (interchange) the values of two variables a and b. ...

Create Facebook wall post from embedded application

Hi, I'm working on a project where I want to post a wall message to the users Facebook page but the problem is that the program will run on a very limited system and the only way I have to talk with Facebook is via sockets in C/C++. Anyone have any code examples of how to do this? Asking for the username/password is no problem so I will...

Why do I get "The procedure entry point CreateVssBackupComponentsInternal could not be located in the dynamic link library VSSAPI.DLL."

Hello everybody let me give you the background first: I'm working on a project that is build with vs2005 on a winxp sp3 with the windows sdk 7.0 and most important the hotfix, that is targeted to work from win xp (sp 0) -> windows 7. part of the project is querying the snapshots and play with the a bit. On my development environment eve...

Doubt in one disadvantage of doing work in constructors

I was reading Google C++ Style Guide, and got confused in the Doing Work in Constructors part. One of the cons of doing heavy work in constructor is: If the work calls virtual functions, these calls will not get dispatched to the subclass implementations. Future modification to your class can quietly introduce this problem ev...

how to pre-allocate memory for a std::string object?

I need to copy a file into a string. I need someway to preallocate memory for that string object and a way to directly read the file content into that string's memory? ...

What does "symbol" mean as in "Load Symbol List"?

What does "symbol" mean as in "Load Symbol List"? Or as in this example from MSDN: "#if lets you begin a conditional directive, testing a symbol or symbols to see if they evaluate to true." Where are these symbols defined and declared? ...

C++ "Choice" Union

Not sure if there is a term for this, "choice" seems to work. I'm working in C++, and I have a bunch of unions I need to create where the union represents a choice of one of the members of the union. The current "choice" is tracked and is always available. I am currently coding these "unions" manually, but I'm wondering whether there is ...

Cannot call member function without object = C++

I am brushing up again and I am getting an error: Cannot call member function without object. I am calling like: FxString text = table.GetEntry(obj->GetAlertTextID()); FxUChar outDescription1[ kCP_DEFAULT_STRING_LENGTH ]; IC_Utility::CP_StringToPString(text, &outDescription1[0] ); The line: IC_Utility::CP_StringToPString(text, &out...