c++

Advanced debugging with dev-c++

I am normaly using Visual Studio 2008 Express, which is quite powerful, but some geeks in head of competition in programming said that we are allowed to use only Dev-C++ as compiler ( I know it's smaller but I think that competition should be about testing your skills in writting code not using all kind of compilers). Anyway in VS2008, e...

string manipulating in C?

I want to print an array of characters, these characters are underscores first. Then the user can write characters on these underscores.I used gotoxy() but it doesn't work properly. That is what i wrote: int main(void) { char arr[20]; int i; char ch; clrscr(); for(i=0;i<=20;i++) { textattr(0x07); ...

Cross-Platform C++ Dynamic Library Plugin Loader

I was just wondering what my options were for cross-platform implementations for the dynamic loading of plugins using shared libraries. So far the only one that I have found is: http://library.gnome.org/devel/glib/stable/glib-Dynamic-Loading-of-Modules.html And I was just wondering if I had other options? Essentially, I want to be ab...

Header-only libraries and multiple definition errors

I want to write a library that to use, you only need to include one header file. However, if you have multiple source files and include the header in both, you'll get multiple definition errors, because the library is both declared and defined in the header. I have seen header-only libraries, in Boost I think. How did they do that? ...

Passing a C# string to an unmanaged C DLL in Windows Mobile

Hi, I've got an unmanaged c++ DLL that I need to call from a Windows Mobile C# app. I've got the C# wrapper and it works nicely in desktop. I can call the DLL functions from a C# desktop program and pass strings around with no problem. However, when I compile the lib and the wrapper for the mobile platform, I get an error in the DllIm...

How does the string class in c++ std work

That is pretty much the whole question. I'm afraid I don't know templates (or C++, really), but I know algorithms and data structures (even some OOP! :). Anyway, to make the question a bit more precise, consider what I would like to be part of the answer (among others I don't know in advance). Why is it coded as a template? How does th...

Is there any free portable (meaning <100mb ) IDE for C++ windows developers with compiler capable of codehinting and tested working with Win32 API?

What I need is a small sized IDE+compiler for creating C++ applications that will interact with win32APIs... And It'd be grat for it to be capable of analizing headers I give it for code completion and connecting DLL's (not .Net DLLs but If it'd be capable ofcompiling C++ .NET projects I would just be super-duper glad) to project should ...

help with wxwidgets intsall

I have been trying to install wxwidgets on visual studios 2010 but I keep getting the same error. It would be great if some one could tell me what it means and how I can fix my problem. This is the error message I keep getting Error 1 error MSB3073: The command "xcopy ....\include\wx\msw\setup.h ....\lib\vc_dll\mswu\wx\ /Y :VCEnd" exit...

How do I write a UTF-8 encoded string to a file in windows, in C++

Hello all, I have a string that may or may not have unicode characters in it, I am trying to write that to a file on windows. Below I have posted a sample bit of code, my problem is that when I fopen and read the values back out windows, they are all being interpreted as UTF-16 characters. char* x = "Fool"; FILE* outFile = fopen( "Se...

c++ unordered_map compiling issue with g++

i am using g++ in ubuntu g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3 Copyright (C) 2009 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. i have this code #include<unordered_map> using namespace std; bool ifuni...

How do I use rand_r and how do I use it in a thread safe way?

I am trying to learn how to use rand_r, and after reading this question I am still a little confused, can someone please take a look and point out what I'm missing? To my understanding, rand_r takes a pointer to some value (or a piece of memory with some initial value) and use it to generate new numbers every time it is called. Each thre...

address in push instruction changing after modifying exe in hex

running on windows 7, 32bit home pro I created a very simple few line app in visual studio 2008 , compiled and linked with standard libraries in release mode into executable test.exe. The code in c is as follows: char* test = "h"; int main() { _asm { push 0xFEEDBACC; } MessageBoxA(0,test,test,0); } which res...

XCode, standard C++ and ifstream file handling.

Recently, I figured out that Xcode could be used to write normal C++ programs. My problem is with the following code : #include <iostream> #include <fstream> using namespace std; int main (int argc, char *argv[]) { char operation='0'; int operand=0; //open file for reading ifstream ifile; ifile.open (argv[1]); ...

Venturi Licensing for my App

I'm looking for some existing code to interface my app with venturi licensing. I'm a bit behind on the whole encryption thing and don't want to re-create the wheel. Does anyone have a working piece they use? I'm writing in C++ and objective-C. Thanks. ...

Learning C++/Java coming from python

As far as my programming career went, I started out with Python, then went into Javascript, now I'm into PHP. I really want to learn a compiled language like c++ and Java. I don't exactly know how to start, especially since I'm currently looking into going into CS or CE in University, and my school don't offer anything that will let me l...

How to tell if current thread is impersonating?

I have a c++ application in which threads could impersonate using LogonUser/ImpersonateLoggedOnUser, and then revert impersonation using RevertToSelf. I ran across the bug which caused thread to impersonate this way twice. I want to prevent this by testing if current thread is already impersonating and throw exception if it is. Is there ...

XOR String Encryption/Decryption

I have made programs that utilize XOR encryption of data before and fully understand it, but how can I implement this into a program so the string literals are encrypted? For instance, I do not want to use: string name = "My name is Matt"; This would cause "My name is Matt" to be located in the executable. I am guessing I would have t...

Display 0.999 as 0.99

How can I display a float number = 0.999 as 0.99? The code below keeps printing out 1.00 ? I thought using setprecision(2) specifies the number of digits after the decimal point? #include <iostream> #include <iomanip> using namespace std; int main(int argc, char** argv) { const float numberToDisplay = 0.999; cout << setpr...

How can I extract a std::string with boost.spirit?

Hi Using boost.spirit I try to parse simple command line of the form command:param1 param2... to do so I created this parser: (+(char_ - ':'))[ref(cmd) = _1] >> ':' >> (*char_)[ref(params) = _1] The attribute types of the two compounds parser is vector, so if cmd and params are of type vector this work. However if they are of type s...

linking with a pragma with g++

In Visual C++, one may link to a library in the code itself by doing #pragma comment (lib, "libname.lib"). Is something similar possible in g++? ...