c++

C++ to UML ( Reverse engineer / Round-trip engineering )

I am looking for a tool that can reverse engineer C++ to UML (and vice-versa). However, the crucial requirement is that it can correctly parse method (member function) bodies so that dependencies are correctly identified. More Detail: In the following code, ClassA is dependant on ClassB, so the UML tool needs to show this with a dashed...

Multiprocessor Scheduling Algorithm

Hi, I'm searching for a Sequential implementation of multiprocessor scheduling algorithm, preferably implemented in c++, or c. Any suggestions are welcome. ...

Send a key to another Windows application with C++

I'm sort of new to c++. I'm trying to send a key to another application, which I know the HWND of. I was thinking of doing ::SendMessage but I'm not sure what parameters to use. I'm trying to send the space key. Thanks. ...

Should I write one method to convert distances or a bunch of methods?

I'm just learning C++ and programming. I'm creating a class called Distance. I want to allow the user (programmer using), my class the ability to convert distances from one unit of measure to another. For example: inches -> centimeters, miles -> kilometers, etc... My problem is that I want to have one method called ConvertTo that will c...

How to create Target/Executables for my .cpp file

Hi, I create a simple test.cpp file in my Xcode project. #include "MyTest.h" #include <stdio.h> int main(int argc, char** argv) { printf ("Calling MyTest Main\n"); } It compiles. I think I need to create a Target and Executables before I can launch in XCode. But I need some help with these questions: 1. What kind of Target i...

Decimal to BCD conversion

I know you can use this table to convert decimal to BCD: 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 Is there a equation for this conversion or you have to just use the table? Im trying to write some code for this conversion but Im not sure how to do the math for it. Suggestions?...

"LNK1104: cannot open file 'X'": How to find out who wants X linked in?

Okay, I'm stumped. I'm fiddling with some project settings, trying to start linking against library Y instead of library X. When I search through the project file (.vcproj) and all the inherited property sheets (.vsprops), there are no references left to library X. I've closed and reopened Visual Studio to make sure it's not holding ont...

C++ vs Java/C# comparison

I found a website comparing Java with C#][1] in very details. Does anybody know any website comparing c++ with Java or c++ with C# in the similar way? ...

delete [] char *, memory issues

I have a global pointer variable char* pointer = new char[500]; /* some operations... */ there is a seperate FreeGlobal() function that does free up the pointer as below: delete[] pointer; First time when the function is called, it actually frees up the memory and now the pointer is a bad pointer. But when we call this more than on...

Is optimizing certain functions with Assembler in a C/C++ program really worth it?

In certain areas of development such as game development, real time systems, etc., it is important to have a fast and optimized program. On the other side, modern compilers do a lot of optimization already and optimizing in Assembly can be time consuming in a world where deadlines are a factor to take into consideration. Questions: I...

B+ tree implementation, * * vs *

I am writing a B+ tree for a variety of reasons and I am come here to ask a question about implementation of its nodes. My nodes currently look like: struct BPlusNode { public: //holds the list of keys keyType **keys; //stores the number of slots used size_t size; //holds the array of pointers to lower nodes NULL if ...

int and string parsing

If i have a int say 306. What is the best way to separate the numbers 3 0 6, so I can use them individually? I was thinking converting the int to a string then parsing it? int num; stringstream new_num; new_num << num; Im not sure how to do parse the string though. Suggestions? ...

C++ dynamically allocated array of statically dimensioned arrays

I need to create a structure that holds a variable number of 'char[2]'s, i.e. static arrays of 2 chars. My question is, how do I allocate memory for x number of char[2]. I tried this (assuming int x is defined): char** m = NULL; m = new char[x][2]; ... delete [] m; (it didn't work) I realise I could use std::vector<char[2]> as a co...

Looking for a free source code analyzer (Function depedency tree)

Does anybody know where I can find a utility/application running on Windows that analyses C source and outputs a functional dependency tree? What I'm looking for is something along these lines: PrintString->PrintCharacter->PrintByte->Printf ...

State Machine Implementation

I'm looking for some general Optimization Correctness Extensibility advice on my current C++ Hierarchical State Machine implementation. Sample variable isMicOn = false variable areSpeakersOn = false variable stream = false state recording { //override block for state recording isMicOn = true //here, only isMicOn is...

C++ : wxWidget HelloWorld

When compiling my wxWidget HelloWorld application, I am getting the following errors: Warning 1 warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library wxWidget__HelloWorld wxWidget__HelloWorld Error 2 error LNK2001: unresolved external symbol "public: virtual bool __thiscall wxApp::Initialize...

Best Practices: Should I create a typedef for byte in C or C++?

The title pretty much says it all, do you prefer to see something like t_byte* (where t_byte would be a typedef for unsigned char) or unsigned char* in code? I'm leaning towards t_byte in my own libraries, but have never worked on a large project where this approach was taken, and am wondering about pitfalls. Regards, Dan O. ...

What is the significance of string data member?

String data What I am particularly confused about is this statement "Its contents are guaranteed to remain unchanged only until the next call to a non-constant member function of the string object." Can someone clarify what does this mean? When to use this and when to avoid using this? ...

GetQueuedCompletionStatus stops reading a serial port

I have a device that generates messages over a serial port. When I reboot the device, the IO Completion Port stops reading bytes. The code is calls GetQueuedCompletionStatus(): BOOL bRet = GetQueuedCompletionStatus( m_hCompletionPort, &dwBytesTransferred, &dwCompletionKey, &pOverlapped, INFIN...

Creating Property grid in MFC

I want to create a property grid (the one which is similar to the one used in the resource editor in VS) using MFC. Does anybody whether there is any built in support in MFC for this? ...