Search the Community
Showing results for tags 'c++'.
Found 11 results
-
Background first, if you please: RadStudio 12.2, in C++ on Windows 11. Monitors status information from up to 4 microprocessor nodes using TTL to USB converters. Each node is a separate board with its own interface. Ideally, I use a serial port package in C++ which (non-blocking) reads a package and updates a data panel on the display. Decoding the packet is no problem, getting it, is. Communication is in ASCII encoded packets to avoid premature terminating zeros, so string reads will work. Tried the APRO interface, but documentation seems to be lacking, with lots of features in the packages I don't need and no basic startup information. Tried the BOOST rabbit hole, which I somewhat got to work (gotta love the documentation (if any)). and then lost the solution. It seems to be blocking only, which I could tolerate if I could create a task. I could do this with a microprocessor, it would simply mirror the drivers in the hardware, using FreeRTOS tasks to read each port (one task = 1 port), and tasks can be blocking without a problem. Anybody know of a well documented serial package that can do non-blocking reads, C++ compatible? Then I need to do multiple threads, haven't looked at that yet in C++. I don't really have a problem with C++, but the add-ons are a problem. Got the UI (more or less customizable) up and running, custom buttons (made from panels) can be enabled/disabled with different text for pressed, different colors when active. so the C++ is not a problem. Thanks in advance Harvey
- 8 replies
-
- c++
- serial data
-
(and 2 more)
Tagged with:
-
I do not find any Code Coverage tool for C++ based applications developed in RAD Studio 11.2 The Delphi Code Coverage tool is working good for Delphi based applications but C++ is ignored. I really want to look into if anyone achieved code coverage for their C++ applications. Require some help here from the C++ intelligent minds.
- 1 reply
-
- codecoverage
- c++
-
(and 1 more)
Tagged with:
-
Hello, I have recently installed and registered C++ builder CE, my first test program is not behaving correctly. It's a trivial C++ program, the file open fails. There is nothing that I can see that is incorrect, I've coded with files for decades. Any suggestions appreciated. #include <iostream> #include <fstream> #include <conio.h> #include <tchar.h> using namespace std ; ifstream ifs ; int _tmain(int argc, _TCHAR* argv[]) { ifs.open ("C:\\Junk\\testfile.txt") ; if (!ifs.good()) // ** Also tried if (!ifs) { cout << "Can't open input file.\n"; while (!kbhit()) ; return 1 ; } cout << "Opened OK\n" ; ifs.close() ; while (!kbhit()) ; return 0 ; }
-
Hello everyone, I am a technician in a company who is making business in Healthcare material. A long time ago, an employee programmed softwares for this company with Delphi 2009. Due to bugs we begin to have, I am in charge to upgrade the apps. But my boss doesn't want Delphi but C++. So I would like to know if I can import the source project into RAD Studio and convert it in C++ to upgrade it. I also began a new app in Delphi but my boss really wants C++, he thinks that Delphi is not good (because he has a friend who is programmer and said Delphi sucks ... very open-minded programmer, indeed). So I need your help to convert all stuff I have in Delphi to C++. It's fine if it's not perfect, I know that I will need to adapt many things, I just don't want to begin with a blank project. I wish you an exellent day and I am waiting for your replies !
-
I am trying to make an api post request using Delphi. I have the working example in c++ but cannot figure what I am doing wrong when I convert it to Delphi code. I posted my original question on Stackoverflow here: https://stackoverflow.com/questions/74521060/converting-c-api-post-request-into-delphi-code C++ Code: CURL *hnd = curl_easy_init(); curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(hnd, CURLOPT_URL, "https://sandbox.checkbook.io/v3/check/digital"); struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "accept: application/json"); headers = curl_slist_append(headers, "content-type: application/json"); headers = curl_slist_append(headers, "Authorization: xxxxxxxxxxxx:xxxxxxxxxxxxx"); curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\"recipient\":\"testing@checkbook.io\",\"name\":\"Widgets Inc.\",\"amount\":5,\"description\":\"Test Payment\"}"); CURLcode ret = curl_easy_perform(hnd); My Delphi Code: unit API_InvoiceCloud; interface uses DB, SysUtils, System.Classes, System.JSON, IdSSLOpenSSL, VCL.Dialogs, IdHTTP, XML.XMLIntf, xml.xmlDom, xml.XMLDoc, IDCoder, IDCoderMIME, IdBaseComponent, IdException, IdZLibCompressorBase, IdCompressorZLib, Rest.Client; procedure CreateDigitalPayment_CheckBookAPI(mRecipientEmailAddress, mRecipientName : String; mPaymentAmount : Double; mPaymentNumber, mPaymentDescription : String); implementation var //{ INDY COMPONENT TO CONNECT TO API SERVER; MAKES CONNECTION } IDHTTP1 : TidHttp; //{ SSL Connection } SSL : TIdSSLIOHandlerSocketOpenSSL; //{ Request and Response vars } JsonRequest, InJson : String; JsonToSend : TStringStream; //object to store json text and pass API JObj : TJSONObject; Const //{ Constant variables holding the APIKEY+APISECRET and BASEURL } nBASEURL = 'https://sandbox.checkbook.io/v3/check/digital'; nAPIKEY = 'xxxxxxxxx:xxxxxxxx'; procedure CreateDigitalPayment_CheckBookAPI(mRecipientEmailAddress, mRecipientName : String; mPaymentAmount : Double; mPaymentNumber, mPaymentDescription : String); var //{ Response into String } ResponseCode : String; { -----------Testing---------- } //lParamList: TStringList; nBASEURL : String; RequestBody : TStream; ResponseBody : String; begin CodeSite.EnterMethod('DigitalPayment_CheckBookAPI'); nBASEURL := 'https://sandbox.checkbook.io/v3/check/digital'; //{ JSON body with request string } JsonRequest := '{"recipient":"' + mRecipientEmailAddress + '","name":"' + mRecipientName + '","amount":' + FloatToStr(mPaymentAmount) + ',"number":"' + mPaymentNumber + '","description":"' + mPaymentDescription + '"}'; try try //{ Create connection instance } IDHTTP1 := TidHttp.Create; //{ SSL Configuration } SSL := TIdSSLIOHandlerSocketOpenSSL.Create; SSL.SSLOptions.SSLVersions := [sslvTLSv1_1, sslvTLSv1_2]; IDHTTP1.IOHandler := SSL; //{ Headers/Params } IDHTTP1.Request.Clear; IDHTTP1.Request.CustomHeaders.FoldLines := False; IDHTTP1.Request.Accept := 'application/json'; IDHTTP1.Request.ContentType := 'application/json'; IDHTTP1.Request.CustomHeaders.Values['Authorization'] := nAPIKEY; //{ Saving JSON text to TStringStream Object } JsonToSend := TStringStream.Create(JsonRequest, TEncoding.UTF8); //JsonToSend := TStringStream.Create(JsonRequest, TEncoding.ASCII); //{ Making POST Request using INDYs TidHTTP component; Params are: URL, JsonStringObj - saving into variable } SinglePartyResponse := IDHTTP1.Post(nBASEURL, JsonToSend); ShowMessage(IDHTTP1.ResponseCode.ToString); except on E : Exception do //{ Display error message if cannot do API CALL } begin ShowMessage(E.ClassName+' error raised, with message : "' + E.Message + '".'); Abort; end end; finally //{ Free objects from memory } IDHTTP1.Free; SSL.Free; JsonToSend.Free; end; end; end. Any help is appreciated, thanks!
-
We started porting the Skia4Delphi library to C++Builder and we came across a problem in the static linking of objects, specifically linking the file “/usr/lib/clang/lib/darwin/libclang_rt.ios.a” which is in the SDK path (ex: “C:\Users\<username>\Documents\Embarcadero\Studio\SDKs\iPhoneOS15.2.sdk\usr\lib\clang\lib\darwin\libclang_rt.ios.a”) In Delphi, this linking is very simple to do. We can simply declare a fake method and add the external '/<sdk_sub_path>/<filename>.a', which is exactly what we do in our Delphi implementation: procedure libcompiler_rt; external '/usr/lib/clang/lib/darwin/libclang_rt.ios.a'; In C++Builder however, we didn't find anything similar. So far we've only been able to force this link in two different (but very rudimentary) ways: Method 1 - Configuring project linking: Adding to the project library path “$(BDSPLATFORMSDKSDIR)\<DefaultPlatformSDK>\usr\lib\clang\lib\darwin\” Note: This is necessary because although some SDK paths are automatically passed to the linker, this is not. Adding the command -lclang_rt.ios to the project link The problem with this method is that apparently there is no environment variable for the <DefaultPlatformSDK>, and adding only relative paths, in this case “\usr\lib\clang\lib\darwin\”, doesn't work. We also tried “$(SDKROOT)\usr\lib\clang\lib\darwin\” but to no avail. Method 2 – Adding objects to the project Directly add the file “libclang_rt.ios.a” to the project. It also works, but this is also a bad option. Questions Is there any other way to force link an SDK object in C++Builder? It would be nice to have a simple solution that requires no configuration: #pragma link "/usr/lib/clang/lib/darwin/libclang_rt.ios.a" // But this don't work Would there be any variables we could use to represent the path of the SDK being used? (Ex: “$(SDKROOT)\usr\lib\clang\lib\darwin\”)
-
Google Tests (unit testing framework) working with Embarcadero C++ clang compiler?
Roger Cigol posted a topic in General Help
Has anyone got Google Tests (unit testing framework) working with Embarcadero C++ clang compiler? if so, using clang32 or clang64 bit? [or, ideally, both?] I can't find any web documentation that tells me if this is currently possible (Embarcadero 10.4.1) or not. (If there is a helpful URL then I would be grateful if anyone can oblige).- 26 replies
-
- c++
- google tests
-
(and 1 more)
Tagged with:
-
I am back from Borland C++ Builder 5, skipped 10 years, and now on Embarcadero C++ Builder 11 PRO. I my have annoying questions with all good intentions of better tools. To the point. Attempting to access PostgreSQL 13 installed on local Windows 10 development box, using FireDAC components with 64 bit VCL Windows desktop project. I am getting error message stating the I need 32 bit version of libpq.dll. I got semi smart and supplied path to 32 bit libpq.dll from older postgres version 10, and all started to work at design time. Unfortunately compiled version trow error that it need 64 bit version of libpq.dll. Is there smart workaround this circle of errors embarcadero put mi in? Hope it is just my 10 years of not using excellent productivity tool. Yes I attempted to access Postgresql 14.1 as well, same issue. That I got running 64 bit application. Is there separate path option for libpq.dll 32bit for design time, and 64 bit for rune time?
-
Overbyte ICS MimeDecode issue with Embarcadero XE10.3 c++
GE1956 posted a topic in ICS - Internet Component Suite
I have a problem using the new v8 version of OverbyteICS with MimeDecode in my C++ project with Embarcadero XE10.3. In my old studio I was able to work with v5 using the TMimeDecode component after including MimeDec.hpp in the unit header file. In the unit cpp file I used #pragma link "MimeDec" to load the library., but in V8 I am not able to find the cpp header file in the extracted Source folder, only the delphi version (OverbyteIcsMimeDec.pas). Is it still possible to use the old methods connected to MimeDecode v5 (Method 'DecodeFile', field 'CurrentData', etc.) in the new Embarcadero XE10.3 (with OverbyteIcs v8)? Or is it maybe possible to use v5 with XE10.3? Whenever I click on the unit file in the project tree, I get a message signaling that the TMimeDecode component couldn't be found. I even tried to add the OverbyteIcsMimeDec.pas file as well as further needed *.pas files, but still the same error is shown. Is there anything else I need to do? The delphi compiler did generate the appropriate *.hpp files in my Embarcadero directory, which I did include in my project. I did also add include "OverbyteIcsMimeDec" to my unit header file, but without success. I would really apprecaite some help regarding my efforts to implement MimeDecodc during the migration process.-
- embarcadero
- c++
-
(and 1 more)
Tagged with:
-
Hallo to all, since 10.4 (and 10.4.1) debugging c++ DLL for x64 Windows S.O. is impossible (for me of course). ALL THE PROJECTS ARE COMPILED FOR X64. If I launch standard debug from Delphi project, the DLL source code (made in c++) is ignored and no breakpoints are used in the DLL. If I launch LLDB debug from c++ DLL (setting the correct host of course), an error like this is generated and the app doesn't start. If you launch the app with or without Delphi debugger all is working. Same situation with remote debugger (via "old style debugger" or paserver). Before LLVM all is working and i can debug DLL c++ code. I miss something or do something wrong ? Attached is a very simple project group to test. Thanks for your attention. Test.zip
-
Wrapping C(++) APIs with Custom Managed Records
Erik@Grijjy posted a topic in Tips / Blogs / Tutorials / Videos
Check out how you can use Delphi's new Custom Managed Records feature to wrap C(++) APIs. https://blog.grijjy.com/2020/07/20/wrapping-c-apis-with-custom-managed-records/