c++

RTF Tags removal by regex problem

Folks, desperately need your help. I am using C++ VS 2008 to strip RTF tags to make search in the RTF text only. The rtf text I get from CRichTextEdit into CString and it works just fine. Here how I try to remove the tags: 1 std::tr1::cmatch res; 2 std::string str = note; 3 const std::tr1::regex rx("({\\)(.+?)(})|(\\)(.+?)(\b)"); 4 std...

Why do I get an EXC_BAD_ACCESS here and how can I make it work?

I'm trying to make my code be able to separate a file into a customer database (it's delimited by many spaces and not tabs). I try to use strtok, but I get an EXC_BAD_ACCESS error. Here is my main.cpp code: #include <iostream> #include <fstream> #include <string> #include <sstream> #include "Cust.h" using namespace std; int main (int a...

C++ programming question

Can Someone tell me what I am doing wrong I have tried my best with this program, please someone with a little more time on their hands so that they can take time to look at the program and Help! Thank you all for your time:) #include <iostream> #include <string> #include <cctype> using std::cout; using std::cin; using std::endl; //fu...

Ideas for computer science project with CORBA or ICE

We have to perform a semester project with distributed computing using CORBA or ICE. It is a single-person project and we have a couple of months of time. For the programming language I'd like to focus on c# for it may be any other like C++. I don't want to write the one millionth prime generator, maybe there is something much more int...

Is there any good tree manipulation (template) libraries for C++ out there?

Is there any good tree manipulation (template) libraries for C++ out there that can do basic things like binary tree. Though it is not difficult to write a binary tree all from scratch, but I'm really surprised that it is not so easy to find one ready-for-use. ...

could not deduce template argument for T[]

now im getting another error.. error C2065:'temp' : undeclared identifier i know that for temp i need to declare the type that the array is like int temp[] but what if i dont know what it is.. it could be int for string or double.. how can i create a temp array not specifing what it should be i added a mergesort function. Here is my c...

Boost Property Tree and Xml parsing Problems.

So a quick question i started using boost::property_tree, anyways. The documentation is very vague and overall unhelpful, for the most part. Looking at the source/examples didnt help that much ether. What im wondering is the following: <VGHL> <StringTable> <Language>EN</Language> <DataPath>..\\Data\\Resources\\Strings\\st...

7bit/xpress compression and decompression algorithm.

hi all can any one provide me 7bit/xpress compression and decompression code using c++ language as i need it for my project Thanx in advance ...

Function Template Specialization on Function Pointers

(C++) I have a sanitization function that I want to run on (traditional) pointer types only. My problem is with function templates I can get as far as limiting the function to only pointers, however because of casting rule differences between function pointers and regular pointers, I run into problems. The Sanitize() function needs ...

Code smell in this switch statement?

I'm wondering where a switch statement of this style should be changed to an if else statement. switch (foo) // foo is an enumerated type { case barOne: if (blahOne) { DoFunction(//parameters specific to barOne); break; } case barTwo: if (blahTwo) { DoFun...

Measuring absolute time taken by a process

Hi I am measuring time taken by my process using QueryPerformanceCounter and QueryPerformanceFrequency. It works fine. As my system is a single processor based system. So many process sharing it.Is it possible to measure CPU time allotted to my process. SO that i can measure absolute time taken. Platform : Windows Language : C++ ...

OpenGL texture won't map - white square?

Alright, so I'm using cairo to turn an SVG into image data for openGL textures. That part works. But now the texture I'm using won't map to the quad I'm making. It's just showing up as a blank square. Is there something up with the order I'm calling things in or is there some secret function I forgot to use? const int SCREEN_WIDTH =...

Finding the index of an entry in a linked list in better than O(n) time...

I have a scenario where I'm pushing change-lists to another system. Each list contains zero or more inserted, updated or deleted notifications. Inserting is easy; the notification contains the target index and a pointer to the item. Updating is easy; I pass a pointer to the item. Deleting seems straight-forward; I need to pass the ...

C++: how to use std::less<int> with boost::bind and boost::lambda?

I am trying to lean boost::bind, boost::lambda libraries and how they can be used with STL algorithms. Suppose I have vector of int-string pairs which is sorted by int key. Then a place to insert a new pair while keeping the vector sorted can be found as follows: std::vector<std::pair<int, string> > entries; ... int k = ...; // Let's i...

C++ and C# COM Event Performance. Help.

Hi All, Good day. CppApp and CsApp Event Handle Design Changed. For Industry application. Old design. CsApp pull event from CppApp. There are a lot of events from CppApp. So we created two threads in CsApp to handle the events from CppApp. It worked very well. New design. CsApp and CppApp com event (fire event method) design inst...

Writing a C++ DLL, then wrapping it in C#.

Hello, I am a bit confused about wrapping a c++ dll in c#. What kind of dll should i create? A normal dll or an mfc dll? Should i prefix every proto with "extern..." ? Should i write the functions in a def file? My last effort was in vain, c# would crash with an error like "bad image format", which means that the dll format is not corr...

Accessing Encrypted Archives

Good Morning, I want to write a password program using C++ that will check the entered password against a file in an encrypted archive to see if it's correct. The archive is fingerprint accessible, but also has a backup password, which I'm assuming would be used. How do I get through the password barrier on the archive to check the file...

how to use cpp unit

Is there a good book or online site discussing the use of the CppUnit, for a beginner? ...

Logging Mechanism using memory mapping technique

Just create a mapping of the file of the required size (CreateFileMapping or mmap), write the lines in the buffer and start over when the maximum number is reached. -- Your answer for write-a-circular-file-in-c. I am also writing the LogWriter module. In this caase i am mapping the whole file to the memory using mmap(). I am maintainin...

Looping over the non-zero elements of a uBlas sparse matrix.

I have the following sparse matrix that contains O(N) elements boost::numeric::ublas::compressed_matrix<int> adjacency (N, N); I could write a brute force double loop to go over all the entries in O(N^2) time like below, but this is going to be too slow. for(int i=0; i<N; ++i) for(int j=0; j<N; ++j) std::cout << adjacency(...