c++

In C++, how system implement the buffered stream ?

Can someone write some sample code to explain this concept? I know what a buffered stream is used for, but I also would like to know how to implement that. Thanks in advance! ...

libcurl and amazon s3

Hi I am wondering if there is a way to set two different write callback functions in libcurl. The problem is that I'm currently using libcurl to communicate with amazon s3 for various operations, creating buckets, uploading, deleting and downloading objects. The problem is with the download function, I have set a callback function to wr...

Can't use DLL (written in C++) in Delphi: The procedure entry point could not be located

I've compiled a DLL in Visual Studio (the source code is in C++, which I barely understand). Here's a piece of Scraper.h: struct SWin { char title[512]; HWND hwnd; }; SCRAPER_API bool ScraperGetWinList(SWin winList[100]); Now I'm trying to use the above function in my Delphi application: type tWin = record title: String;...

LoadLibraryW doesn't work while LoadLibraryA does the job

I have written some sample program and DLL to learn the concept of DLL injection. My injection code to inject the DLL to the sample program is as follows (error handling omitted): std::wstring dll(L"D:\\Path\\to\\my\\DLL.dll"); LPTHREAD_START_ROUTINE pLoadLibraryW = (LPTHREAD_START_ROUTINE)GetProcAddress(hKernel32, "LoadLibraryW")...

windows form application

I have code in c++ about AVL TREE AND have all function..the code is in win32 consol Can i include it to project in windows form application without rewrite it another or in the so simple try?????? because i have so much project in consol and i want to apgrade it thank you very much.... ...

Can I use BOOST_CHECK only in unit tests?

Or Can I use it in regular code? If the answer is "no", then is there C++ library that will provide me with all the macros like CHECK_EQUAL, CHECK_CLOSE, etc.? ...

Some questions on C++ struct and array

Hi! I am relatively new to C++ and am having problems understanding struct. I have a struct declared as follow struct MyNode { int level; int index; MyNode children[4]; } However the code fails to compile and reports error C2148: total size of array must not exceed 0x7fffffff bytes. But the following code compiles stru...

How to include lua scripting language into C++ XCode?

I have successfully compiled lua in my mac. It works. It runs. Now, I want to mix it with C++ in XCode. So I looked up in the Linked Library, the usual place to add more libraries in XCode. But of course, lua isn't there. Now, how do I tell XCode the existence of lua so that the program can include lua.h correctly? ...

In what order do C++ objects passed as arguments to constructors of other objects go out of scope?

When I compile the following code with g++, the object of class A seems not to be destructed when the object of class C is constructed, and the B.ref_a reference is not broken when accessed by the constructor of object of class C: #include <iostream> struct A { A(int aa) { a = aa; } ~A() { std::cout << "A...

How to implement monkey patch in C++?

Is it possible to implement monkey patching in C++? Or any other similar approach to that? Thanks. ...

How to handle execvp(...) errors after fork()?

I do the regular thing: fork() execvp(cmd, ) in child If execvp fails because no cmd is found, how can I notice this error in parent process? ...

C++ RPC tutorial?

Hello everyone, I want to learn programming C++ (native) on Windows platform for RPC communication. I want to learn both server and client side. I also want to learn some advanced topics, like performance and security. Any good recommended materials to read? (BTW: I Googled a few, but all of them either too brief or COM related, I wan...

How to make XCode put required resources in "build" folder?

I am trying out lua script with C++ in Mac OS X. I was finding a way to make the program returning the current working directory. That's no problem with getcwd, but then I came one thing: My foo.lua stays at its initial path only. When I compile program, it is not being copied over to the build/Debug directory. Sure, I can grab my scrip...

What happens in assembly language when you call a method/function?

If I have a program in C++/C that (language doesn't matter much, just needed to illustrate a concept): #include <iostream> void foo() { printf("in foo"); } int main() { foo(); return 0; } What happens in the assembly? I'm not actually looking for assembly code as I haven't gotten that far in it yet, but what's the ba...

SDL_Mixer sound problems

Basic Info: Programming Language - C++ Platform - Windows Audio Formats - wav and mid I recently finished a game and was fooling around with figuring out the best way to upload it to a file hosting site. I eventually decided on using 7zip's self-extracting feature. However, I think the mistake I made was that instead of just copying ...

How to display floating-point numbers with a mantissa set to zero in C++?

The following code displays floating-point numbers in scientific notation: float foo = 1.0; ::cout::setf(::std::ios::scientific); ::std::cout << foo; It produces this output: 1.000000e-000 What I would like to do is display floating-point numbers in a specific notation which resembles the scientific notation but with a mantissa set...

Which STL reference book would recommend?

I am considering to put one of the following as a reference on my desk (as I am sick and tired to google every time I have a STL question): The C++ Standard Library: A Tutorial and Reference STL Tutorial and Reference Guide: C++ Programming with the Standard Template Library Generic Programming and the STL: Using and Extending the C++...

What does typedef do in C++.

typedef set<int, less<int> > SetInt; Please explain what this code does. ...

convert rgb 2 black & white in opencv

i need to know the function that convert RGB image into black &white(binary image) & i need to know if i can save modified image after conversion on hard disk if so what's this function? ...

Subclass of QGraphicsLayoutItem for stretchers?

The specializations of QGraphicsLayout (e.g. QGraphicsLinearLayout) include an insertStretch method. What kind of object do QGraphicsLinearLayout::insertStretch method insert in the list of items managed by the layout? Better asked: what type of object is returned by QGraphicsLayout::itemAt method when called for a stretch position? ...