C++

57K

Solutions

24K

Contributors

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

Hi,

The below one is rough from actual one.  If I call only T2, application works fine. When I call T1 and then T2, then fuse_main fails with /dev/fuse already mounted as per /etc/mtab.

Here, I am surprised, how  T1 thread affects T2 thread. What could be the reason.

void*  someworkerfn()
{
     //some logic
}

void* call_fuse_main()
{
     //prepare agrs (-s,-f,-o,allow_other...)
    //fuse_main
}

int main()
{
      pthread_create(id1, NULL,someworkerfn,NULL);  //joinable thread-T1
      pthread_create(id1, NULL,call_fuse_main,NULL); //joinable thread-T2

      return 0;
}

Thanks,
bvm
0
PMI ACP® Project Management
LVL 13
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

Hi,

   I have called third-party  api from main thread in c++ on linux which is working fine as expected. But, when I call same api from child thread, it's failing in multi threaded application.

   technically what could be the reason? (not interested to check with third-party people).

Thanks,
bvm
0
Tried to use VC++ 2008 command line utility cl to compile the code that contains an array with variable size. A lot of errors were generated. In Linux all needs to do is to include the option -std=C99 when compiling.  Is there any workaround for it? Can any gurus shed some light to it? Thanks a lot.
0
I'm getting the following linker error when building a solution for a Visual Studio 2019 windows console program...

Error      LNK2001      unresolved external symbol "public: virtual void __thiscall kymeta::sensor::API::StartServiceA(void)const " (?StartServiceA@API@sensor@kymeta@@UBEXXZ)

I have no method in my code that is named 'StartServiceA'. Where is this coming from?
0
How do I add "text to speech" to my desktop C++ application?   I use MS2017.  I cannot assume an internet connection - so "cloud services" are out.   Can one get the modern neural-network speech-to-text ability as a linkable DLL?
0
Hello,
  We have a PCL-1712 PCI Data aquicision device (DAQ). I want to get the data from analog input and pass the to analog output in almost realtime. The DaqNavi SDK contains and DAQ Emulator which you can use for programming/test. Since the SDK is buggy with Delphi it needs to be done in MFC/C++.

Anyone can program it ?

SDK Link: https://support.advantech.com/support/DownloadSRDetail_New.aspx?SR_ID=1-13L33UP&Doc_Source=Download

Thank you
0
Hello all;
I have a C++ Embarcadero Project which use DevExpress Components; When I try to compile it, I have à dialog which ask me for the path to static libraries:

dxMapControlRS17

dxGaugeControlRS17

dcldxMapControlRS17

dcldxGaugeControlRS17

I searched for these libraries everywhere, but unfortunately, i have found nothing even by googling these names, nothing!

What do you think? any suggestions?

Thanks in advance!
0
Hello;
I have a program c++ which call a Delphi DLL; The Delphi DLL has to inform the program c++ by the result of his work several times during his lifecycle.

in yours opinions what are the possibles methods for doing this? without using files ou databases like a third part!

Thanks in advance.

I will list here what i think:

- First idea is by passing a pointer to delphi dll when launching it; but i don't know which types to use in the two sides and how Delphi treat pointers!

- Second idea is by using an intermediate c++ DLL; Delphi will call a function in the DLL C++ which will modify the values of the c++ dll variables. in the other side, when the c++ program launch the c++ dll, it will pass a pointer. When delphi call the c++ function, the function will fill the pointer passed by c++ program. Do you think that works?

I don't know if i was clear; Thank you
0
Hello!

I am a beginner in programming by C ++. This is my first question on EE also.

I am learning the book of Bjarne Stroustrup "Programming. Principles and Practice Using C ++".
I'm using MS Visual Studio 2019 for creation of C ++ programs.

I am performing following exercise:
“Define an Order class with (customer) name, address, data, and vector<Purchase> members. Purchase is a class with a (product) name, unit_price, and count members. Define a mechanism for reading and writing Orders to and from a file. Define a mechanism for printing Orders. Create a file of at least ten Orders, read it into a vector<Order>, sort it by name (of customer), and write it back out to file. Create another file of at least ten Orders of which about a third arc the same as in the first file, read it into a list<Order>, sort it by address (of customer), and write it back out to file. Merge the two files into a third using std:: merge().”
I wrote the program consisting of the following files:
1.      std_lib_facilities.h
Header file from B.Stroustrup
2.      Exersize_9.h
This file contains declarations of functions.
3.      Address_definition_file.cpp , Date_definitions_file_.cpp, Order_definitions_file.cpp, Purchase_definition_file.cpp
These files contain definitions of functions
4.      Exersize_9.cpp
This is a main file.
5.      File_input.txt
Input data are in this file. For an example, I took three objects
6.      File_output.txt
 Result data are in this file

And at last problem:
0
When I try to run roxio nxt 7, I receive this error: Roxio-VideoWave---Error---2019-08-05.pdf
0
Become a CompTIA Certified Healthcare IT Tech
LVL 13
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

I would like to solicit your help please.
I would like to call a specific C# feature from within a C++ programming environment, such as:
            Microsoft MSVC 2017 enterprise edition.  The specific C# specific is:          
                              System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() method.

This is not a school project/assignment. From what I have looked at, there is a lot more programming required that I am not able to understand.  Could you help me out please.....  Thank you.
RSVP.   Thad.

This is what I have come up with...
 using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Xml;

 using System.Net.NetworkInformation;  /// they say this "networkinformation stuff is C# material.
 public static BOOL IsAvailable(int * xx) {
       bool IsAvail;
       bool IsAvail = NetworkInterface.GetIsNetworkAvailable();
       *xx = IsAvail;
       return (IsAvail);
 }
0
I am using an Indy 10 UDP client component with Embarcadero C++ builder EX 10.1 Berlin

I need to determine the IP address of the local PC that received the broadcast packet (not the peer IP). there are two network cards.
The UDP client is bound to 0.0.0.0 port 13580

How do I determine the IP address of the Ethernet port that generated the event ?

void __fastcall TForm1::IdSystatUDPServer1UDPRead(TIdUDPListenerThread *AThread, const TIdBytes AData,
          TIdSocketHandle *ABinding)
{
	UnicodeString u;


	u = ABinding->IP; // this is the binding which is 0.0.0.0
 	u = AThread->Binding->IP; // I was expecting this to give what I want but it returns .0.0.0.0

	if(u == u"10.41.0.20")  // only use specified local ethernet port
{
.....
}
else
{ // handle differently if another network adapter received the data

}

Open in new window

1
Hi!

The application to be developed consists of Webserver and the TCP Server. The TCP server listens to specific port and keeps on sending Keepalive and messages. While the HTTP server accepts user input and send the data to the TCP Server. So my question here is whether the TCP server can act as the HTTP Server. If so how can this be scheived. I am using Poco C++ libraries for HTTP and TCP server If there is some example please can you guid me here.,
0
Hi,

  aws efs mounted (nfs 4) on rhel 7.4.  On my machine, I have ~10 mounts. How do I find whether it is efs mounted from us-east-1 or other mounts?  Is there any function or systemcall to find out from c or c++? Already tried with statvfs and statfs calls.

Thanks,
Bvm
0
I would like to see any examples of QuickReport 6.0 professional BarChart code for Embarcadero C++ Builder XE 10.1 berlin please ?
0
My application consists of  GUI application, an  application which resides on controller  and the server application. I am developing my application with C++ for the Poco libraries. The controller should communicate with the GUI and the server through the TCP /IP protocol. So My question here is whether I need to setup my GUI as server? If some one can forward me the sample of TCPServer created with Poco libraries which listens to specific ip adress and port.
0
From C++ how can I capture and iterate through the output results of an Oracle PL/SQL stored procedure that returns data as "TABLE of NUMBER(7)", or "TABLE of VARCHAR2(100)" etc?  I haven't found a clear example or documentation that details the accessing data returned as tables.
   I'm using the MS VC9++ (VS2008 SP1) with the Oracle 11.2 32-bit Instant Client. At this point I need to stay at these versions to not risk breaking the compilation of a much larger project with a lot of legacy hardware and drivers.  I've tried many variations that don't compile, or give runtime errors. Running OTT has prove problematic as the TYPE definitions only exist when the procedure is run.
   I'm currently using the OCCI interface but am open to using C++ .net if it will coexist with the current C++ code.

PL/SQL package definition

create or replace PACKAGE          "CARRIERPKG" AS
    TYPE tcarrier_site     is TABLE of NUMBER(7)      INDEX BY BINARY_INTEGER;
    TYPE tpart_serial      is TABLE of VARCHAR2(100)  INDEX BY BINARY_INTEGER;
    TYPE tpart_rtn_msg     is TABLE of VARCHAR(200)   INDEX BY BINARY_INTEGER;
   
 
      PROCEDURE get_parts_v12
      (p_carrier_serial	  IN  phase2.carrier_site.carrier_serial_num%TYPE,
       p_part_num         IN  phase2.part_info.PART_NUM%TYPE,
       p_carrier_type     IN  phase2.carrier_type.id%TYPE,
       carrier_site       OUT NOCOPY tcarrier_site,
       part_serial        OUT NOCOPY tpart_serial,
       rtn_msg            OUT 

Open in new window

0
Hi Experts,

Can Indy use SSL with POP3 Client? I am looking for a solid example of code of using Indy POP3 with SSL to retrieve messages. I need it to be in C++ Embarcadero RAD 10.3.

All the best,

MusicBuddha.
0
Hello Experts,

Currently I have the following:

APP_A is a C# Win Form

APP_HW  is a C++ Windows Application that exposes various COM classes

This works fine, and APP_A can use the COM classes from APP_HW.


Now I want to change APP_HW from a C++ application to a C# WinForm application (I'll call it APP_HW_CS) and expose COM classes from it that can be used by APP_A. However, I do not want to use Reflection to achieve this. Reflection will just load APP_HW_CS for APP_A to use,  and I need to have APP_A link to a running APP_HW_CS for it's COM classes.

I have read a lot of information online. I have a COM object that is registered and exported from the APP_HW_CS (C# version). But the only way to use it appears to add the APP__HW_CS as a reference and then create the objects. But putting it as a reference seems to make it load a new version of APP_HW_CS and not use the running APP_HW_CS.

Is what I am trying to do even possible?

Thanks for any help and any references you can point me too.

Brian.
Using VS2013 on Windows 7 Pro 64bit.
Compiliing as a 32bit app.
0
OWASP Proactive Controls
LVL 13
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

I have in my API a value mapping:

cParams.nVerifyBufferSize = (int32)Params->VerifyBufferSize;

Open in new window


How is the best way to make sure that there is a valid value given? Like
Params->VerifyBufferSize

Open in new window

is possible invalid (nothing) I want to give 1 if not a valid value.
Any suggestion?  Wiath a boolean value I use

Params->FullCapacity ? BS_TRUE : BS_FALSE;

Open in new window


I think is a  goodsolution, isn't it? Something similar for VerifyBufferSize is needed

I use this inside a dotNet component.
0
My question is how to use C++ string  under Digital Mars.. I have downloaded the zipped packages: dmc587c.zip and stlport.zip. Not really knowing how to properly install them together other than just unzipped the folders, I tried a command line compiling the following code, which used to work though, simply with:

> ...\bin\dmc.exe   goesto4.cpp...

But I got "file not found"  error message for the  included <string> file.  Could anyone provide an example how to compile/link codes that use C++ string class?

 #include <string>
#include <math.h>


int number_of_letters = 0;

 string ones[10] = {"zero","one","two","three","four","five","six","seven","eight","nine"};


Thanks

Ze
0
what is the purpose of the property TStringGrid->TextSettings->WordWrap in an FMX  StringGrid when setting it to true appears to have no effect ? Especially with respect to word wrapping in cells. I am using the StringGrid in a windows application using Embarcadero C++ bulder XE 10.1 Berlin Update 2.
Searching on the web leads me to conclude that the only way to display wrapped text in a StringGrid appears to be drawing the cell contents with an OnDrawColumnCell event handler ?
0
I want to implement a openfiledialog using CFileDialog with custom filter,
where I can get list of files and choose one by one which one to be shown or not,

For this I have tried to hook with OPENFILENAME's HookProc, But it only gets callback for old style dialog I want to implement it for new style dialog,

Could anyone please explain me, how can I implement this type of filter with new style explorer dialog, using any possible way or workaround.
0
Hi, I'm writing a simple text editor as coding practice in C++ using the Win32 API
and I wanted to add line numbers to the left hand side of the RichEdit control. I
have created a margin by sending a EM_SETMARGINS message to the RichEdit then I
subclassed the RichEdit and responded to the WM_PAINT message. Here's the subclass code :

LRESULT CALLBACK WndEditProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	case WM_PAINT:
		{
		CallWindowProc((WNDPROC)OldWndProc, hWnd, message, wParam, lParam);
		HDC hdc = GetDC(hWnd);
		DisplayLineNumbers(hdc);
		ReleaseDC(hWnd, hdc);
		return 0;
		}
		break;
	case WM_DESTROY:
		SetWindowLong(hEdit, GWL_WNDPROC, (LONG)OldWndProc);
		break;
	}

	return CallWindowProc((WNDPROC)OldWndProc, hWnd, message, wParam, lParam);
}

Open in new window


As you can see I called the old window procedure first and then called my DisplayLineNumbers
function coz it didn't work properly if DisplayLineNumbers was called then the old window
procedure was called. But I have a problem with my DisplayLineNumbers function and I'm
not sure how to fix it. It seems to work but when I open a big file then scroll to the end
of the file the line numbers don't line up to the line of the RichEdit and when I hit enter
at the bottom of the file the line numbers skip a few. I must stress that I am a novice
coder so don't expect the code to be perfect but here's the DisplayLineNumbers function
that I wrote (hEdit is the handle of the RichEdit and hFont is the handle of the font and
it accepts a DC for the RichEdit, szBuffer is a buffer for the line number text) :


Open in new window

0
I have a WizardPage that has been developed with MFC.  I don't have access to internal CTabCtrl structure or PropertySheet directly, but only can use following macros :

TabCtrl_SetItemSize or PropSheet_GetTabControl. When I switch between Wizard Pages, I see that the tab items gets out of boundingrectangle of the parent control.

I eventually want to run the following  :       GetTabControl()->ModifyStyle(0, TCS_VERTICAL);

But this does not work

How can I overcome this problem ?
0

C++

57K

Solutions

24K

Contributors

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.