C++ is an intermediate-level general-purpose programming language, not to be confused with C or C#. It was developed as a set of extensions to the C programming language to improve type-safety and add support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.

Share tech news, updates, or what's on your mind.

Sign up to Post

Is there a tool to calculate line checksum of motorola S3 Record ?

For example, following is line of motorola S3 Record:


To calculate checksum manually, one byte of size, four bytes of address, and all data bytes are summed.  Extract least significant byte
from the sum, take it's one's complement and that's the checksum.

Is there a checksum calculator or tool that will calculate the checksum ?

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


after solving some ugly other problems with make, I run now into the problem about the CXXFLAGS. It looks like make do not use this FLAGS.  My makefile looks like:

CXX = g++
CXXFLAGS = -g -std=c++11 -Wall -pedantic

root := /usr/share/doc/xsd/examples

include $(root)/build/cxx/rules.make
include $(root)/build/xsd/tree-rules.make

$(CXX) $(CXXFLAGS) -c 05_bxf2.cxx

	$(CXX) $(CXXFLAGS) -c XSDValidator.cpp

	$(CXX) $(LDFLAGS) -o XSDValidator.o 05_bxf2.o

	rm -f *.o

Open in new window

The repsone I got in termional after calling make

g++ -W -Wall -O3 -c 05_bxf2.cxx

Open in new window

This is not what I added to the makefile. Any idea why make do not use the Flags?
Hi i was having some problems in finding the screen width and height how ever i am working on an project and i finally found

Open in new window

but every time i use this function in CLR i am getting this problem :
1>Width.obj : error LNK2028: unresolved token (0A00002E) "extern "C" int __stdcall GetSystemMetrics(int)" (?GetSystemMetrics@@$$J14YGHH@Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z)
1>Width.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall GetSystemMetrics(int)" (?GetSystemMetrics@@$$J14YGHH@Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z)

Open in new window

Isn't it supported in Clr ? if yes what i can use instead.
Hello everyone.

I've seen that what I'm trying to do which is monitoring the file IO require the use of Window File System Filter driver and I've also looked into it but was a bit hard to understands especially as I'm not a C++ developer. What I want to achieve is to be able to trap file copy, creation, as well as file sources and destinations, lets say I'm copying a file within my computer I want to get the source path of the file as well as destination path of the file and also the file name as well and if possible with the application that is sending the file.

I saw that this can also inform you if there is file access(opening of file, reading of file) this is very much important to me to also get it if possible while the request of file open is created. I wan to trap this and if the file is one of my file then I want to first work on the requested file first (decrypt).

Thank you.
We just moved from WinINET to WinHTTP. The latter does not have an equivalent InternetCanonicalizeUrl function.

The WinHTTP docs say that WinHTTPOpenRequest does this automatically but there is nothing there that specifically addresses this.

According to this reference you can use WinHTTPCreateURL which uses a URL_COMPONENTS structure to define the various URL parts. In the latter the lpszExtraInfo property is where you put the ?param=xyz& ... part.

Here is my problem - one of the parameters in the paramter string needs to be canonicalized as it could contain non-URL friendly characters (Example &).

With the WinINET version we used InternetCanonicalizeUrl on the specific URL parts which were then appended to the URL string.

If we have a URL now that looks like this
mydomain.com?param='Name & Surname','Description'

Open in new window

And we pass that to WinHTTPOpenRequest - it does not know that the & in Name & Surname is data and not a parameter separator.

How do we canonicalize individual parameters in the URL with WinHTTP
Hi Experts,

         I have a alpha numeric text of length (4096 to 8192)Bytes. I need a compression algorithm to compress and decompress text length upto (128 to 256)Bytes.

I have already tried some compression methods but not able to compress text upto (128 to 256)Bytes .
(eg: Zip.)

To perform this job we need only compression method not hash value.

Thanks In advance
language : c++
(tools : visual studio , acrobat reader)
thanks a lot
I have installed 2 different IDM Ultrium-TD3 tape drives and in the 2nd case, I have ALSO installed the lin_tape and lin_taped (daemon).  I also have sg3_utils 1.42, built from source - all this are on x86_64 bit computers.

Many of the commands work, including sg_read_buffer for reading the cartridge memory.

The problem is, commands such as sg_read_attr/sg_write_attr (ioctl 0x8D, 0x8C) whether from a normal C program or from the sg approach, do not ever allow reading or writing the attributes - instead, it leads to an error, such as:

SG_WRITE_ATT_0803 command error: Host_status=0x05 [DID_ABORT]
Error : Write failed (try verbose opt)

I can try either generic /dev devices or /dev/IBM types of devices.  Each gives an error.  In one case, I have an idea for how to try to fix it, but I'm just wondering, is the firmware (mine is 6B20) just not implementing it?  I doubt that's the problem.  I can upload the firmware as hex code but I would like to see the source.

Also, I don't know whether or not running lintape/lintaped matters and whether or not the IBM-generic/IBM-specific/sg-generic drivers are the issue.  I'm trying to pin down what approach to go on next.  There are literally three sets of drivers.  And I don't know whether or not I should install Tivoli.

Given all the variables, I just want to know how to proceed to get to a working sg_read_attr/sg_write_attr command.  I even tried to start with the lowest numbered attribute.

I have also tried external …
I am writing a REST client application using Embarcadero C++ builder Xe10.1 Berlin.
I need to have the REST server IP address configurable.
I have initially set the TRESTClient component BaseURL property to a known server IP address in the IDE. The BaseURL property value is and the application works just fine.
If I add code to change the BaseURL property however, the application doesn't respond and times out ?
Even if I use the value that works when set in the IDE, after the following code is run the application stops working ?

RESTClient1->BaseURL = u"";

Open in new window

Any ideas please ?
MFC CComboBox won't display wide characters.
I'm using VS 2008, UNICODE is defined in the build and all of the prompts and other strings in the app are coming out fine.
The first try I just added the strings like any combobox and the display and dropdown showed a black line for each
character like the font was wrong.

I tried to SetFont to no avail.

I went to an owner-drawn combo box with no change.
The string shows correctly in the debugger (both in the watch and in the hover box).
the string is "Активна" and, copied from the debugger window,  shows up fine in WordPad.

In DrawItem I did:

      CString fontName;
      CDC dc;

//fontName is "MS Sans Serif" which is is expected and what I am using in the rest of my app and is reported to support Cyrillic.
//The rest is :

      CString thisString;
      GetLBText(lpDrawItemStruct->itemID, thisString);      

//note that at this point,  thisString shows to have the correct string in the debugger

      dc.TextOut(rc.left+iOffsetX, rc.top + iPosY,thisString);      

And I get " ||||||| "  in the combo box (both edit box and dropdown).

      dc.TextOut(rc.left+iOffsetX, rc.top + iPosY,L"TESTSTRING");
works fine.

Any ideas would be helpful...I've been working this way too long.
Industry Leaders: We Want Your Opinion!
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

HOW TO CONVERT * char to string (linha):

const unsigned char
*menino1 = (const unsigned char *)0;

menino1 = p - 17;

string linha = menino[1]+menino[2]+menino[3]+menino[4]+menino[5];
I had this question after viewing C++ COM Method with Optional Arguments.

I am trying to produce a COM object in Visual C++, where one of the methods accepts optional arguments. Below are the interface declaration, the class implementing the interface, and the implementation of the method taking an optional argument. As it stands, it compiles. But when I try to call the function from an ASP page using VBS with the supposedly optional parameter missing, I get the following error

Microsoft VBScript runtime error '800a01c2'
Wrong number of arguments or invalid property assignment: comObject.ShowFinalSql

Following code in IDL
interface IWPharma : IDispatch{
   [id(2), helpstring("method ShowFinalSql")] HRESULT ShowFinalSql([in] BSTR query, [in] BSTR cleanup);

in C++:
    STDMETHOD(ShowFinalSql)(BSTR query, BSTR cleanup) override

in VB with error:
SET comObject = CreateObject("WPharma.Main")

REM Тест #1
comObject.ShowFinalSql "CHECK_SIGNATURES 01/01/2017", ""
Let's say you have a COM interface,IWebBrowser2, it has a function, it has a function Navigate, Is there anyway that I can hook to this function, like I hook CreateProcess function in kernel32.dll?

Thank you for any help.

I have a problem with custom templates not creating solutions correctly. It works fine on my Home computer but not on my office computer. I have reinstalled VS 2015 several times but problem remains. The issue is the "Location" and "Solution Name" dialog are not visible nor are the "Create directory for solution" or "add source to control" checkboxes and browse button.

Below is an example of what happens and below is one of the template files (this effects several new project templates under c++).

If I select New -> Visual C++ -> Empty Project, I get the following dialog at bottom of window (You can see that "Location Field" is Enabled and yet it does not show when I create a new project)

Name: Project 1
Location: C;\users\david\visual studio 2015\projects
Solution Name : Project 1
Also a "Browse" button, "Create directory for solution" checkbox and "add to source control" checkbox.

If I select New -> Visual C++ -> Particle Project (which is one of the custom projects) I get

Name : Sketch1

All the other dialogs and checkboxes are missing.

BUT, When I am on my computer at HOME, I see all the correct solution name, location and checkboxes ok, but NOT on my OFFICE computer.

I am sure it is related to some setting in a file somewhere that is overriding the parameters for the VM template but don't know which file will be controlling this behavior.

<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" …
My work Environment :Qt 5.8 MSVC2015 64bit, QT GraphicsView, QGraphicsRectItem, Windows 7 64 bit.

Issues : When I zoom in & zoom out on GraphicsView, I call GraphicsView scale method. But When I add QGraphicsRectItem to scene it failed to call its paint method.

my class hierachy :

  class GraphicsView : public QGraphicsView
  class mySquare : public QObject, public QGraphicsRectItem
  class Scene : public QGraphicsScene 

Open in new window

Code :

//////*****Draw Rect in QGraphicsRectItem *****////////////

void mySquare::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
      QRectF rect(0,0,_width,_height);

Open in new window

 void GraphicsView::wheelEvent(QWheelEvent * event)
    int angle = event->angleDelta().y(); // angle will tell you zoom in or out.
    double scaleFactor = 1.15; //How fast we zoom
    if (angle > 0)
        qDebug()<<"Zoom in";
        scale(scaleFactor, scaleFactor);
        qDebug()<<"Zoom out";
        scale(1.0 / scaleFactor, 1.0 / scaleFactor);
        mySquare  _square = new mySquare(0,blankImage);
       _square->setPos(QPointF(0, 0));
       //add square to scene. 
] //Bug!!! Why after scale function call, _square failed to draw rect in paint method.
]        _scene->addItem(_square);

Open in new window

My git gitcode
I spend days & hours but still not able to find out why it QGraphicsRectItem failed to print, when scale method get called. Any suggestion is highly appreciated ?
Hi All,

I want to change the face color of property sheet wizard button. The wizard has ID_WIZNEXT, ID_WIZFINISH and other default button. the button label and position is changed. i want to change the color of this default button.

class CDiskSanPropertySheet : public CPropertySheet

BOOL CDiskSanPropertySheet::OnInitDialog()

        CButton *tmpButtonNext = reinterpret_cast<CButton *>(GetDlgItem(ID_WIZNEXT));
      CButton *tmpButtonFinish = reinterpret_cast<CButton *>(GetDlgItem(ID_WIZFINISH));
      CButton *tmpButtonBack = reinterpret_cast<CButton *>(GetDlgItem(ID_WIZBACK));
      CButton *tmpButtonCancel = reinterpret_cast<CButton *>(GetDlgItem(IDCANCEL));


        LONG rightPos, nextRightPos;
      //inc. to 1.7 for greek issue
      MoveButton(tmpButtonCancel,shiftFactorX, 1.7,NULL,tmpButtonNext,&nextRightPos);
      MoveButton(tmpButtonFinish,shiftFactorX, 1.7,NULL,NULL,NULL);

      rightPos = nextRightPos;

      MoveButton(tmpButtonNext,shiftFactorX, 1.7,&rightPos,tmpButtonBack,&nextRightPos);
      rightPos = nextRightPos;
      MoveButton(tmpButtonBack,shiftFactorX, 1.7,&rightPos,NULL,NULL);


HBRUSH CDiskSanPropertySheet::OnCtlColor(CDC* pDC, CWnd *pWnd, UINT nCtlColor)
    HBRUSH hbr = CPropertySheet::OnCtlColor(pDC,pWnd, nCtlColor);

    COLORREF myColor = …
I installed C++ builder 6.0 on windows 10.
when I reopen a project , my working directory don't change to new project path and my new forms create on the directory that last time I used "FILE->Open Project" method.
if every body knows how can say to it change to the project path after reopen .
-- thanks reza
I wish to implement interactive gesturing (Zoom)  in an android application that uses an FMX TGrid control. so far I have not succeeded.

The Embarcadero documentation for enabling Firemonkey  Interactive gesturing is as follows :
Enabling Standard Gestures To add support for standard gestures for a control, you need to do the following:

In the Form Designer, add a TGestureManager to the control you want to enable for gestures. Either give the GestureManager a unique name or just use its assigned name, such as GestureManager1.
In the Object Inspector, assign the TGestureManager in the Touch | GestureManager field of the control.
In the Object Inspector, select the specific custom gesture(s) from the Touch | Gestures field of the control.
Implement the OnGesture event procedure for the control and handle the appropriate EventInfo.GestureId.

I am stuck in " Implementing the  OnGesture event procedure for the control and handle the appropriate EventInfo.GestureId"

Any help would be appreciated.

I am using C++ Builder XE10.1 Berlin

I have "tree" include file that not wanna associate with the cpp file.
#include <stdio.h>
#include "../sys/pcsc.h"  <<  fatal error C1083
#include "/sys/util.h"  <<  fatal error C1083
#include "sys/clessCardType.h" <<  fatal error C1083

i tried three different ways to link the in the cpp file.

print screen added
Free Tool: Subnet Calculator
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

I want to invoke a python script from my C++ app and get the data from the python script into my C++ app. How do I do this?

example: testing.py   reads data from and ADC -

C++ app - invoke testing.py  ; data = python testing.py
Hi guys.

I have Form1.h and Test.cpp files in my project which was generated by VS. I have around 5 functions in my Test.cpp file and each function has to update the label with its result. I've made the label1 public on my Form1.h file and with this solution I am now able to write to the label1 outside the h file, I mean I can write to the label1 from .cpp file but only when the application is starting up or should I say only from the main function. I've used the solution provided on this post here and now my problem is that I can not use the same approach on other 5 to 6 functions as this approach also uses the

Open in new window

which I don't think is appropriate to keep calling this from each and every function that needs to update the label.

The updates are based on the App returned results for each and every function its execute.
Hello I'm using C++ builder 10 and I need to bold (highlight) the last value that comes into advmemo from  advcombobox/advedit.
Maybe somehow with using AdvMemo->SyntaxStyles->HighlightStyle?
can you help me to solve this problem?
Assume there are 5 students in a class. Each semester 3 exams are
taken by each student. Create functions to determine the class
average, highest grade and lowest grade for each exam. The
requirements are –
1) Create a function to read in 3 grades for each student. A two
dimension array int stuGrades[TOTAL_STUDENTS][TOTAL_TESTS] must be
used to hold all the grades for each exam for all the students, where
TOTAL_STUDENTS and TOTAL_TESTS are defined as –
const int TOTAL_STUDENTS=5;
const int TOTAL_TESTS=3;
2) Create a function to print out students’ grades.
2) Create a function to determine the class average, highest grade and
lowest grade for each exam.
3) Create a function to print out the results for each test.
The following functions should be defined/implemented and called in
main() –
void readStuGrades(int stuGrades[][TOTAL_TESTS]); //make sure to
validate each grade. Grade must be in between 0 and 100.
Void printStuGrades(int stuGrades[][TOTAL_TESTS]);
void getExamAvgMinMaxGrade(int stuGrades[][TOTAL_TESTS], int exam,
float &avg, int& low, int& high);
void printExamStatistics (int exam, float avg, int low, int high);
This question is for Visual C++ MFC application in Visual Studio Community 2015 under Windiws 7.

When you set some text in multi line CEdit box in OnInitDialog function, that is called to initialize dialog's controls. the text is displayed as selected (highlighted.) No manipulations with CEdit interface in OnInitDialog can't remove this highlighting (Like using SetSel(-1,0).)  
Somebody knows how to initialize CEdit with no selection?
I am looking for a piece of software that will let you select a USB device and convert its output signals (when buttons are pressed on the device) into keystrokes or configurable macros.

In more detail, I have this remote control (more accurately, a USB handset/phone) that sends USB signals depending on which button is pressed and the software I currently use converts those signals into keystrokes or macros. The software I currently use however is extremely limited, non-configurable and obsolete.

Any help is greatly appreciated!






C++ is an intermediate-level general-purpose programming language, not to be confused with C or C#. It was developed as a set of extensions to the C programming language to improve type-safety and add support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.