c++

How to import external dll library to Borland C++ 6?

I build an application in Borland C++ 6 and I'd like to import external, non Borland library (FFTW, to be exact, http://www.fftw.org). I have downloaded the fftw dll file, used the implib.exe program to build a lib file known to Borland, included fftw.h in source and copied fftw.h to Borland/include, fftw.lib to Borland/lib and .h, .dll ...

Is there an easier way to pop off a directory from boost::filesystem::path?

I have a relative path (e.g. "foo/bar/baz/quux.xml") and I want to pop a directory off so that I will have the subdirectory + file (e.g. "bar/baz/quux.xml"). You can do this with path iterators, but I was hoping there was something I was missing from the documentation or something more elegant. Below is the code that I used. #include ...

GetAdaptersInfo and GetAdaptersAddressess BufferLength Param

I've got some legacy code in C++ here that does some things I don't understand. I'm running it in Visual C++ 2008 Express Edition on a machine running Windows XP. The code uses some Windows functions: GetAdaptersInfo and GetAdaptersAddressess. I realize that the final parameter for both of these is a pointer to the size of the buffer a...

Generate HTML Pages from C Structures

hi I would like to develop a application (i prefer c++), which will take C header file with lot of nested structures as input and generate a html page where the data will be presented as Hierarchial tree structures, which can be collapsed.. file.h struct level1 { struct level2 { struct level3 { } } }; file.html...

C++ convert hex string to signed integer

I want to convert a hex string to a 32 bit signed integer in C++. So, for example, I have the hex string "fffefffe". The binary representation of this is 11111111111111101111111111111110. The signed integer representation of this is: -65538. How do I do this conversion in C++? This also needs to work for non-negative numbers. F...

Eclipse c++ makefile project output

Hi, I have a c++ Makefileproject for eclipse, if I build it, the binary is in the project root. How can I change the build directory to {ROOT}/bin? I Tryed project propertys -> c/c++ Build -> Build location (Build directory: MY PATH) but than it can't compile at all. ...

Setup main function in eclipse makefile project

I created a new HalloWorld Makefile Project. There is a HalloWorld.cpp with my main function. Now I have a file /src/startup.cpp that conains a main function. Now I want to use the main function from /src/startup.cpp Where can I tell eclipse to use that one? ...

C++ string.compare()

I'm building a comparator for an assignment, and I'm pulling my hair out because this seems to simple, but I can't figure it out. This function is giving me trouble: int compare(Word *a, Word *b) { string *aTerm = a->getString(); string *bTerm = b->getString(); return aTerm->compare(bTerm); } Word::getString returns a st...

Why do multiple threads eat my memory

I have a Windows C++ application that holds a std::hash_set containing abount 5 Million entries each with 32 Bytes. If i create the hash_set in a separate (of many) threads it uses > 1 GB according to ProcessExplorer. I see this when i free the list. If i create it in the main thread it ueses 200 MB. This phenomenon only applies to the 3...

Why would I want to use a pure virtual function in C++?

I'm learning about C++ in a class right now and I don't quite grok pure virtual functions. I understand that they are later outlined in a derived class, but why would you want to declare it as equal to 0 if you are just going to define it in the derived class? ...

C++: Accessing types from dependent base classes

Does anyone know why using-declarations don't seem to work for importing type names from dependent base classes? They work for member variables and functions, but at least in GCC 4.3, they seem to be ignored for types. template <class T> struct Base { typedef T value_type; }; template <class T> struct Derived : Base<T> { // Version...

How do I use MySQL C++ Connector for storing binary data?

I have a block of binary data defined as: void* address, size_t binarySize; that I want to store to a MySQL database using MySQL C++ Connector. The function setBlob() takes istream. The question: How can I convert from a raw void* address, size_t binarySize to either an istream object or istringstream? Is it possible to do this with...

can't seem to build a Qt project on eclipse (C++, Windows)

I have Qt installed + Qt Eclipse Integration + MinGW but I can't seem to find a way to build a new Qt GUI project. I'm getting the following error: Error launching builder (mingw32-make debug ) (Cannot run program "mingw32-make": Launching failed) I've updated the Path variable and added all I can think about that can be related and n...

Can't Cast Integer to Char in Char Array

Hey guys, I am trying to practice C++ and while doing so I ran into a problem in my code. I dynamically create a character array and then for each array index, I want to fill that element with an integer. I tried casting the integer to a character but that didn't seem to work. After printing out the array element, nothing comes out. I wo...

How to read "Contributing Artist" metadata in C++?

Windows 7 has a very nifty way of showing "Contributing Artist" metadata in Windows Explorer. In wonder how can I access that metadata from C++? Maybe you even point to some source code? Greatly appreciate in advance. ...

Detect scrolling in WebPage from IE extension

I'm creating an IE extension (using VS2008, C++) that needs to react to scrollbar events in IE. I'm using BHO for that and I have access to IWebBrowser2 element, IHTMLDocument2 element and HWND of the parent window. I can't figure out how to access the scrollbars. I have seen codes that allows me to handle the scrollbar once I have acces...

Dynamically allocated arrays or std::vector

Hey, I'm trying to optimize my C++ code. I've searched the internet on using dynamically allocated C++ arrays vs using std::vector and have generally seen a recommendation in favor of std::vector and that the difference in performance between the two is negligible. For instance here - http://stackoverflow.com/questions/381621/using-array...

SQL-Like Selects in Imperative Languages

I'm doing some coding at work in C++, and a lot of the things that I work on involve analyzing sets of data. Very often I need to select some elements from a STL container, and very frequently I wrote code like this: using std::vector; vector< int > numbers; for ( int i = -10; i <= 10; ++i ) { numbers.push_back( i ); } vector< int ...

Data streaming in MATLAB with input data coming in from a C++ executable

I'm completely new to MATLAB and I want to know what my options are for data streaming from a C++ file. I heard of using the MATLAB "engine" for this purpose, and some of the methods like engPutVariable, etc., but can someone give me a thorough example of how to go about doing it? I'm trying to implement streaming a sine wave, but a sim...

yyparse is printing a leading tab

In my bison/flex program, right after yyparse() is called, a leading tab is printed, but I don't know why. Can you see what's wrong? This calls the bison code, and right after yyparse() returns, a tab is printed. void parseArguments(int argc, char** argv) 130 { 131 int i; 132 133 int sum = 0; 134 // calculate the length of...