c++

How to read 3rd party application's variables from memory?

Dears, I'm trying to read variables from memory. Variables, that doesn't belong to my own program. For instance, let's say I have this Adobe Shockwave (.dcr) application running in browser and I want to read different variables from it. How it's being done? Do I need to hook the process? But it's running under virtual machine, so I don'...

Compile a DLL in C/C++, then call it from another program

I want to make a simple, simple DLL which exports one or two functions, then try to call it from another program... Everywhere I've looked so far, is for complicated matters, different ways of linking things together, weird problems that I haven't even begun to realize exist yet... I just want to get started, by doing something like so: ...

checksum calculation

To calculate CRC I found a piece of code but I am not understanding the concept. Here is the code: count =128 and ptr=some value; calcrc(unsigned char *ptr, int count) { unsigned short crc; unsigned char i; crc = 0; while (--count >= 0) { crc = crc ^ (unsigned short)*ptr++ << 8; i = 8; ...

Avoiding unneccessry recompilations using "branchy" development model

I'm using Mercurial for development of quite a large C++ project which takes about 30 minutes to get built from the scratch(while incremental builds are very quick). I'm usually trying to implement each new feature in the new branch(using "hg clone") and I may have several new features developed during the day and it's quickly getting ...

How to identify if a library is DEBUG or RELEASE build?

Our project is using many static libraries to build the application. How can we make sure we are using release version of libraries in release build of application? we are making mistakes by taking debug library in release application build. I am looking for an elegant way in which I can write a module in that we can check whether a part...

How to write a vb.net code to compile C/C++ programs?

I'm trying to make a vb.net application that has got 2 textboxes, 7 radio buttons and 2 buttons(one named compile and the other 'run'). How can I load the content of a C/C++(or any programming language) file into the 1st textbox and on clicking the compile button, i should be able to show the errors or the C/C++ program in the 2nd textbo...

Is there any performance difference between for() and while()?

Or is it all about semantics? ...

How do you determine the last valid element in a STL-Container

If i iterate over a STL container i sometimes need to know if the current item is the last one in the sequence. Is there a better way, then doing something like this? Can i somehow convert rbegin()? std::vector<int> myList; // .... std::vector<int>::iterator lastit = myList.end(); lastit--; for(std::vector<int>::iterator it = myList...

(c++) The benefits / disadvantages of unity builds?

Hi, since starting at a new company I've noticed that they use unity cpp files for the majority of our solution, and I was wondering if anyone is able to give me a definitive reason as to why and how these speed up the build process?, as I would've thought that editing one cpp file in the unity files will force recompilation of all of th...

Well written C++ examples

I'm currently learning C++ and would like to start reading others sourcecode to pick up tips. I was wondering if anyone has examples of well written C++ that I can take a look at (and not pick up bad habits from) ...

How to hide the exporting functions in DLL

I don't want user to see all the exporting functions through Dependence in my DLL, is there a way to do it? I complie my DLL with C++ and MS Visual Studio. ...

Memory usage of C++ / Qt application

I'm using OS X 10.5.6. I have a C++ application with a GUI made with Qt. When I start my application it uses 30 MB of memory (reported by OS X Activity Monitor RSIZE). I use this application to read in text files to memory, parse the data and finally visualize it. If I open (read to memory, parse, visualize) a 9 MB text file Activity Mo...

Mixing Qt with STL and Boost - are there any bridges to make it easy?

Are there any bridges to make mixing Qt with STL and Boost as seamless and easy as possible? This is a followup to Mixing Qt and Boost, where no specific answers how to accomplish this were given. ...

Reading and writing to a buffer

Hi, I have 2 classes, one that writes multiple 96bit objects to a buffer (32bits at a time - 3x int32), and one that i want to read from the same buffer. The first class (Writer) reserves and area of memory and creates a pointer to the first 32bit area. 1) How do I write to the buffer safely (ignoring buffer overflow for now)... I nee...

application couldn't be initialized error (manifest file problem)

Hi there. I am trying to use a library (.dll) in my project. Everything seems to be set up fine. It all works in release mode. When I go debug on it, I get this darn error on startup: ldr: ... application couldn't be initialized error (or similar, I translated it) I learned that this has to do with manifest files. I fumbled around a ...

CMap with string as key and structure as value

hi, My requirement is given a string as key to the map i should be able to retrive a structure. Can any one please post a sample code for this. Ex: struct { int a; int b; int c; }struct_sample; string1 -> strcut_sample ...

Handling Deprecated Includes With Autoconf

I have been using ext::hash_map in a C++ project and notice that in g++ 4.3 it is deprecated in favor of unordered_map. I need to maintain compatibility with old systems that do not have unordered_map available. It occurs to me that this is just the sort of thing that could be handled by autoconf, which I am already using. I have been...

Implementing "app.exe -instruction file" notation in C++

Greetings. I have a project for my Data Structures class, which is a file compressor that works using Binary Trees and other stuff. We are required to "zip" and "unzip" any given file by using the following instructions in the command line: For compressing: compressor.exe -zip file.whatever For uncompressing: compressor.exe -unzip...

Are std::vector elements guaranteed to be contiguous?

My question is simple: are std::vector elements guaranteed to be contiguous? In order word, can I use the pointer to the first element of a std::vector as a C-array? If my memory serves me well, the C++ standard did not make such guarantee. However, the std::vector requirements were such that it was virtually impossible to meet them i...

error LNK2019: unresolved external symbol Visual C++

I've got this MFC application i'm working on that needs to have an embedded database. so, i went on hunting for a slick,fast "embeddable" db 4 it and stumbled accross SQLite. now, i've created a DB with it, and i created a static library project with VS2k8.the library project will be used in another main project . in the library projec...