Curently I'm passing my const string values up from my C++ into my C# at startup via a callback, but I'm wondering if there's a way of defining them in a C++ header file that I can then also refer to in C#.
I already do this with enums as they are easy.
I include a file in both my C++ library project (via a .h file with a pragma once at...
hello,
I am wondering if it's possible to display full file path using the assert macro?
I cannot specify full file path in compilation command, is there still a way to do it?
My debug environment is linux/g++
...
Is there any compiler that has a directive or a parameter to cast integer calculation to float implicitly. For example:
float f = (1/3)*5;
cout << f;
the "f" is "0", because calculation's constants(1, 3, 10) are integer. I want to convert integer calculation with a compiler directive or parameter. I mean, I won't use explicit casting ...
I need some help revising this. It keeps only displaying 0s as the temp. Thank you.
// A program to determine whether the input number is a perfect number
// A perfect number is defined by the sum of all its positive divisors excluding itself
// 28: 1+2+3+7+14 = 28.
int perfect, limit, divisor;
cout << "Please enter a positive intege...
I have the following code:
tmp_data = simulated_data[index_data];
unsigned char *dem_content_buff;
dem_content_buff = new unsigned char [dem_content_buff_size];
int tmp_data;
unsigned long long tmp_64_data;
if (!(strcmp(dems[i].GetValType(), "s32")))
{
dem_content_buff[BytFldPos] = tmp_data;
dem_content_buff[BytFldPos + 1] = tm...
I have a class B which inherits from A which in turn derives from enabled_shared_from_this. Now, I want to get a shared pointer to B from an instance of B. shared_from_this will return shared_ptr<A>, not shared_ptr<B>. Should I use boost::static_pointer_cast here? Or is there a better way?
...
Hi everybody.
Are there any guidelines how to transit to x64 with as little pain as possible?
Suppose, I have a windows native x86 executable written in C++. The EXE works fine by itself, but there is also DLL that is hosted by both, the former EXE and an outside x64 process. With setup like this, what parts would I need to rewrite?
I...
Hi
I have a header field of 2 bytes where first four bits are packet type and other 12 bits are for length. but i don't know how to store this values and retrieve them.
I am using ms c++ for client and java for server. It is the client which has to set this values and server has to retrieve it.
Thanks
...
I have the misfortune of having use conio.h in vc++ 6 for a college assignment,
My problem is that my graphic setup is in the center of the screen...
e.g.
gotoxy( getcols()/2, getrows()/2);
printf("Enter something");
scanf( "%d", &something );
now if someone accidentally hits enter before they enter the "something", then the cur...
Here is a generic question. I'm not in search of the best answer, I'd just like you to express your favourite practices.
I want to implement a network protocol in Java (but this is a rather general question, I faced the same issues in C++), this is not the first time, as I have done this before. But I think I am missing a good way to i...
I'm having a hard time here trying to find a solution for my problem.
I'm trying to convert a client API funktion from C++ to VB.NET,
and i think have some problems with the callback function.
parts of the C++ code:
typedef struct{
BYTE m_bRemoteChannel;
BYTE m_bSendMode;
BYTE m_nImgFormat; // =0 cif ; = 1 qcif
char *m_s...
I am developing a scientific data acquisition application using Qt. Since I'm not a deep expert in Qt, I'd like some architecture advise from the community on the following problem:
The application supports several hardware acquisition interfaces but I would like to provide an common API on top of those interfaces. Each interface has a...
Isn't there a boost::scoped_lock constructor that takes a boolean as the second parameter? I thought I had used it before.
boost::scoped_lock(Mutex &mx, bool initially_locked)
The documentation for scoped_lock shows the second parameters as "unspecified". Anyone know what in the @(*$ that is suppose to mean?!?
the errors I get are:
...
I'm developing a OpenGL based simulation in C++. I'm optmizing my code now and i see throughout the code the frequently use of std:list and std:vector. What is the more performatic: to continue using C++ stl data structs or a pointer based linked list? The main operation that involve std::list and std::vector is open a iterator and loop ...
I wish to send text between processes. I have found lots of examples of this but none that I can get working. Here is what I have so far:
for the sending part:
COPYDATASTRUCT CDS;
CDS.dwData = 1;
CDS.cbData = 8;
CDS.lpData = NULL;
SendMessage(hwnd, WM_COPYDATA , (WPARAM)hwnd, (LPARAM) (LPVOID) &CDS);
the receiving part:
case WM_COPY...
Say I have:
class Vector3 {
float x, y, z;
... bunch of cuntions ..
static operator+(const Vector3&, const Vector3);
};
Now, suppose I want to have classes:
Position, Velocity,
that are exactly like Vector3 (basically, I want
typedef Vector3 Position;
typedef Vector3 Velocity;
Except, given:
Position position;
Vector3 v...
Hi, I'm trying to figure out how to redirect istream to wxwidgets.
I was able to accomplish redirecting ostream, here's how (so you know what I mean):
wxTextCtrl* stdoutctrl = new wxTextCtrl(...);
wxStreamToTextRedirector redirect(stdoutctrl); //Redirect ostream
std::cout<<"stdout -- does this work?"<<std::endl; //It worked.
I'...
Why is the Child class's converter constructor called in the code below?
I mean, it automatically converts Base to Child via the Child converter constructor. The code below compiles, but shouldn't it not compile since I haven't provided bool Child::operator!=(Base const&)?
class Base
{
};
class Child : public Base
{
public:
Child() ...
I'm using gcc with the -finline-functions optimization for release builds. In order to combat code bloat because I work on an embedded system I want to say don't inline particular functions. The obvious way to do this would be through function attributes ie attribute(noinline). The problem is this doesn't seem to work when I switch on...
There is a question in my programming languages textbook that is as follows:
Write a C function that includes the
following sequence of statements:
x = 21;
int x;
x = 42;
Run the program and explain the
results. Rewrite the same code in C++
and Java and compare the results.
I have written code, and played with i...