c++

Why does Win32 API function CredEnumerate() return ERROR_NOT_FOUND if I'm impersonated?

I've written some sample code which when I call from the windows command prompt under the context of a normal user account, dump's all the user's saved credentials using CredEnumerate(). However, I really want to be able to do this from SYSTEM user context so I've tested my program from a SYSTEM cmd prompt. When I running my program a...

Need to Write C code from C++ Code ?

I need to write my 4-5 .cpp and .h file to c code. In C++ code we have defined class,constructor,destructor,function in the class. How to convert them in C code ? Can somebody give me example of it so that i can implement it or provide link so that i can better explore it to my C code ? How to implement all the functionality i mean cons...

Using Win32 libraries through Windows Form elements

I have created a simple GUI using Windows Forms in visual C++ 2008. There is a button in the GUI. When the button is pressed I want mouse cursor to point at coordinates (0,900). I have created separate header and c++ source file that sets the cursor position to specified location (x,y). For this I have used Win32's SetCursorPos() functio...

Convertion from extended ascii to utf8

How do you convert an std::string encoded in extended ascii to utf8 using microsoft visual studio 2005? I'm using google protocol buffer and it's complaining about non utf8 characters in my string if I give it without conversion, which is true... ...

Help on using boost relaxed heap

Hello all, I'm implementing a few graph algorithms at the moment and am wanting a container with the complexity of a fibonacci heap or a relaxed heap (specifically I want at least O(logN) for push and pop and O(1) for reduce_key). I'm not keen on implementing this myself if at all possible (development and testing overhead and time) an...

Color console boxes in linux terminal

So I have noticed that things (for lack of a better word) like this and are just done in the console using special characters and changing their color. I know how to accomplish this on windows but how would I go about doing this in linux (I am using ubuntu if that matters)? Are there any predefined classes out there to help const...

Link error using Cygwin toolchain

Hi. I need to use Cygwin to compile C++ code for an Android project. I'm having trouble compiling even a basic "hello world" program. The console gives me this message: /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld: unrecognized -a option `ware' I've googled the error and the only result I've found was an issue...

C++ Program Apparently Printing Memory Address instead of Array

#include <iostream> using namespace std; int main(){ int findMax(int *); const int MAX = 100; int values[MAX]; char ivals[256]; // Get the space-separated values from user input. cin.getline(ivals, 256, '0'); char *helper; // Clean input array and transfer it to values. for(int i = 0; i < (MAX) && iv...

Virtual member functions and std::tr1::function: How does this work?

Here is a sample piece of code. Note that B is a subclass of A and both provide a unique print routine. Also notice in main that both bind calls are to &A::print, though in the latter case a reference to B is passed. #include <iostream> #include <tr1/functional> struct A { virtual void print() { std::cerr << "A" << std:...

I need to call a dll that is calling 5 other dlls repeatedly in one application.

I'm currently using SQLitening (www.sqlitening.com) in a C++ application where I'm calling SQLitening.dll. SQLitening.dll makes subsequent calls to SQLiteningClient.dll, Zlib.dll and SQLite3.dll. I am hooking SQLitening.dll explicitly, executing a few functions, and then I am closing the connection and dereferencing the dll with FreeLi...

How do I disable tailcall optimizations in gcc

Hi all, Wondering if anyone knows the flag for gcc to disable tailcall optimizations. Basically in a tailcall optimization, gcc will replace a stack frame when the return value from a called function is passed through (via return) or nothing else happens in the function. That is, in void main() { foo(); } void foo() { ...

embedded webserver for status reporting in c++?

I'm writing a large system in C++ and want to include an embedded webserver for management and reporting. Can anyone make some recommendations? TIA ...

Execution at main method

Hii , We generally see that the program execution begins in the main method for the languages like C , C++ , Java (i am familiar with these). I want to know how the compiler knows the presence of MAIN method in the program . What does the main method signify besides that it is the entry point for program execution ...How does these cr...

How to use boost::unit_test?

I'm trying to learn how to test programs so I tried Boost. I've started reading it and here I've met this line: Now I can compile it and link with the unit test framework. From where and how am I suppose to get unit test framework? And what it is? I just do not know what to eat it with. Could someone please provide some steps how to ...

Where can I find a c++ memory allocator testbed?

Possible Duplicate: Benchmarks used to test a C and C++ allocator? Hello all, I've recently written an STL compatible custom allocator + memory manager, and I need a good (preferably multi-threaded) testbed to verify that it's working correctly. I could roll my own, but I imagine there are pretty good ones out there that hav...

How can DIR* get EBADF error?

I have some code that I have inherited which is part of a class for iterating, accessing the directory content and uses boost::filesystem::path. The code reads in part: struct directory_iterator_impl { private: void skip_dots(const path& p, const char* who) { static const std::string d("."); static const std::string dd(".."...

Overloading functions not compiling

Hi guys, I am following the book C++ Cookbook from O'Reilly and I try one of the examples, here is the code: #include <string> #include <iostream> #include <cctype> #include <cwctype> using namespace std; template<typename T, typename F> void rtrimws(basic_string<T>& s, F f){ if(s.empty()) return; typename basic_strin...

Using C++ Technical Report 1 (TR1) in VC++ 2010

How do I use a C++ TR1 library in visual c++ 2010? ...

Calling a Visual Basic DLL in C++

I have acquired a DLL that was created in Visual Basic from a third party vendor(Sensor DLL.dll). This DLL contains functions for talking to a sensor, and I need to call these functions from a Visual C++ program I am writing. The vendor will not provide a header file, and I do not know Visual Basic. If I had a header file this would b...

what does following code do?

i dont understand what does following code? #include <iostream> #include <cstdlib> using namespace std; struct node{ int k; node * l,*r; node (int t){ k=t; l=0;r=0; } }; typedef node * link; link Max(int a[],int l,int r) { int m=(r+l)/2; link x=new node(a[m]); if (l==r) return x; x->l=Max(a,l,r...